diff --git a/estimator/lwe_dual.py b/estimator/lwe_dual.py index bf8a0e5..107d121 100644 --- a/estimator/lwe_dual.py +++ b/estimator/lwe_dual.py @@ -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 ) diff --git a/estimator/reduction.py b/estimator/reduction.py index cbdac59..1800cba 100644 --- a/estimator/reduction.py +++ b/estimator/reduction.py @@ -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), @@ -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 @@ -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),