Skip to content

Commit

Permalink
try this
Browse files Browse the repository at this point in the history
  • Loading branch information
bencrts committed May 8, 2024
1 parent 60808bd commit c91db54
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions estimator/lwe_dual.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ def cost(
k_fft,
p,
)

rho, T_sample, _, beta_sieve = red_cost_model.short_vectors(
beta, N=N, d=k_lat + m, sieve_dim=beta_sieve
)
Expand Down
19 changes: 16 additions & 3 deletions estimator/reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@ def _short_vectors_sieve(self, beta, d, N=None, B=None, preprocess=True, sieve_d
self.delta(sieve_dim) ** (sieve_dim - 1) * self.delta(beta) ** (1 - sieve_dim)
)

#arbitrary choice
if c > 2**1000:
c = oo
return (rho, oo, oo, sieve_dim)

return (
rho,
ceil(c) * self(beta, d),
Expand Down Expand Up @@ -883,7 +888,7 @@ def short_vectors(self, beta, d, N=None, preprocess=True, B=None, C=5.46, sieve_
rho = sqrt(4 / 3.0) * RR(
self.delta(sieve_dim) ** (sieve_dim - 1) * self.delta(beta) ** (1 - sieve_dim)
)

if N == 1:
if preprocess:
return 1.0, self(beta, d, B=B), 1, beta
Expand All @@ -892,8 +897,16 @@ def short_vectors(self, beta, d, N=None, preprocess=True, B=None, C=5.46, sieve_
elif N is None:
N = floor(2 ** (0.2075 * sieve_dim)) # pick something

c = N / floor(2 ** (0.2075 * sieve_dim))
sieve_cost = C * 2 ** (self.NN_AGPS[self.nn]["a"] * sieve_dim + self.NN_AGPS[self.nn]["b"])
c0 = RR(N)
c1 = RR(2 ** (0.2075 * sieve_dim))
c = c0 / floor(c1)
sieve_cost = C * 2 ** RR((self.NN_AGPS[self.nn]["a"] * sieve_dim + self.NN_AGPS[self.nn]["b"]))

#arbitrary choice
if c > 2**1000:
c = oo
return(rho, oo, oo, sieve_dim)

return (
rho,
ceil(c) * (self(beta, d) + sieve_cost),
Expand Down

0 comments on commit c91db54

Please sign in to comment.