Skip to content

Commit

Permalink
Merge pull request #112 from malb/issue-110
Browse files Browse the repository at this point in the history
fix Issue 110
  • Loading branch information
malb committed May 8, 2024
2 parents 027c60a + 56111bc commit f18533a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 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
27 changes: 25 additions & 2 deletions estimator/reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,16 @@ 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:
# set c = oo
return (
rho,
oo,
oo,
sieve_dim,
)

return (
rho,
ceil(c) * self(beta, d),
Expand Down Expand Up @@ -892,8 +902,21 @@ 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:
# set c = oo
return (
rho,
oo,
oo,
sieve_dim,
)

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

0 comments on commit f18533a

Please sign in to comment.