Skip to content

Commit

Permalink
push WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bencrts committed Feb 6, 2024
1 parent e3f49d0 commit 825220c
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions estimator/lwe_primal.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,13 @@ def gaussian_heuristic_log_input(r):

d = len(r)
r = [log(x) for x in r]

for i, _ in enumerate(r):
if gaussian_heuristic_log_input(r[i:]) < D.stddev**2 * (d - i):
return ZZ(d - (i - 1))
if gaussian_heuristic_log_input(r[d - (i + 1):]) > D.stddev**2 * (i + 1):
return ZZ(i)
return ZZ(2)


@staticmethod
@cached_function
def cost(
Expand Down Expand Up @@ -588,8 +590,20 @@ def __call__(
log_level=log_level + 1,
)


def find_zeta_max(params, red_cost_model):
usvp_cost = primal_usvp(params, red_cost_model = red_cost_model)["rop"]
zeta_max = 1
while zeta_max < params.n:
if params.Xs.support_size(zeta_max) > usvp_cost:
# double it for mitm
return 2 * zeta_max
zeta_max +=1
return params.n

if zeta is None:
with local_minimum(0, params.n, log_level=log_level) as it:
zeta_max = find_zeta_max(params, red_cost_model)
with local_minimum(0, zeta_max, log_level=log_level) as it:
for zeta in it:
it.update(
f(
Expand All @@ -603,6 +617,7 @@ def __call__(
else:
cost = f(zeta=zeta)


cost["tag"] = tag
cost["problem"] = params

Expand Down

0 comments on commit 825220c

Please sign in to comment.