Skip to content

Commit

Permalink
bugfix(lwe_primal): fix precision error in log computation
Browse files Browse the repository at this point in the history
  • Loading branch information
bencrts committed Dec 30, 2024
1 parent 374f073 commit 93629e9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion estimator/lwe_primal.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,13 @@ def gaussian_heuristic_log_input(r):
return exp(log_gh)

d = len(r)
r = [log(x) for x in r]
try:
r = [log(x) for x in r]
except ValueError:
# shift and re-compute
c_shift = 1e-300
r = [log(c_shift) + log(x / c_shift) for x in r]
print(r)

if d > 4096:
for i, _ in enumerate(r):
Expand Down

0 comments on commit 93629e9

Please sign in to comment.