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..583122b 100644 --- a/estimator/reduction.py +++ b/estimator/reduction.py @@ -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), @@ -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),