From 4594f36ec95673115fad84394d8fdda3568a342c Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 6 Feb 2024 11:51:53 +0000 Subject: [PATCH] try this --- estimator/lwe_primal.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/estimator/lwe_primal.py b/estimator/lwe_primal.py index eb1fb4f..7598760 100644 --- a/estimator/lwe_primal.py +++ b/estimator/lwe_primal.py @@ -590,16 +590,19 @@ def __call__( log_level=log_level + 1, ) - if zeta is None: - # cost usvp for a baseline + + def find_zeta_max(params, red_cost_model): usvp_cost = primal_usvp(params, red_cost_model = red_cost_model)["rop"] - # compute a reasonable zeta_max based on the secret distribution and usvp_cost - for i in range(params.n): - if params.Xs.support_size(i) > usvp_cost: - zeta_max = i - else: - zeta_max = params.n + zeta_max = 1 + while zeta_max < params.n: + if params.Xs.support_size(zeta_max) > usvp_cost: + # double it for mitm + return 2 * zeta_max + zeta_max +=1 + return params.n + if zeta is None: + zeta_max = find_zeta_max(params, red_cost_model) with local_minimum(0, zeta_max, log_level=log_level) as it: for zeta in it: it.update(