Skip to content

Commit

Permalink
push WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bencrts committed Feb 5, 2024
1 parent e3f49d0 commit e6f57d8
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions estimator/lwe_primal.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,21 @@ 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))
return ZZ(2)


if len(r) > 8192:
for i in range(len(r) - 1000, len(r)):
print("i = {}".format(i))
if gaussian_heuristic_log_input(r[i:]) < D.stddev**2 * (d - i):
return ZZ(d - (i - 1))
return ZZ(2)

else:
for i, _ in enumerate(r):
print("i = {}".format(i))
if gaussian_heuristic_log_input(r[i:]) < D.stddev**2 * (d - i):
return ZZ(d - (i - 1))
return ZZ(2)

@staticmethod
@cached_function
Expand Down Expand Up @@ -480,8 +491,11 @@ def cost_zeta(
40, baseline_cost["beta"] + 1, precision=2, log_level=log_level + 1
) as it:
for beta in it:
#print("beta = {}".format(beta))
it.update(f(beta))
#print(f(beta))
for beta in it.neighborhood:
#print("beta = {}".format(beta))
it.update(f(beta))
cost = it.y

Expand All @@ -490,9 +504,10 @@ def cost_zeta(
# step 2. optimize d
if cost and cost.get("tag", "XXX") != "usvp" and optimize_d:
with local_minimum(
params.n, cost["d"] + cost["zeta"] + 1, log_level=log_level + 1
params.n, cost["d"] + cost["zeta"] + 1, log_level= log_level - 1
) as it:
for d in it:
#print("d = {}".format(d))
it.update(f(beta=cost["beta"], d=d))
cost = it.y
Logging.log("bdd", log_level, f"H2: {cost!r}")
Expand Down

0 comments on commit e6f57d8

Please sign in to comment.