Skip to content

Commit

Permalink
perf(prob): speed-up simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
bencrts committed Dec 17, 2024
1 parent 5c9fc14 commit 27e36ef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions estimator/prob.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def gaussian_cdf(mu, sigma, t):
return RR((1/2)*(1 + erf((t - mu)/(sqrt(2)*sigma))))


def mitm_babai_probability(r, stddev, fast=False):
def mitm_babai_probability(r, stddev, fast=True):
"""
Compute the "e-admissibility" probability associated to the mitm step, according to
[WAHC:SonChe19]_
Expand All @@ -94,7 +94,8 @@ def mitm_babai_probability(r, stddev, fast=False):
# Note: `r` contains *square norms*, so convert to non-square norms.
# Follow the proof of Lemma 4.2 [WAHC:SonChe19]_, because that one uses standard deviation.
xs = [sqrt(.5 * ri) / stddev for ri in r]
p = prod(RR(erf(x) - (1 - exp(-x**2)) / (x * sqrt(pi))) for x in xs)
p_list = [RR(erf(x) - (1 - exp(-x**2)) / (x * sqrt(pi))) for x in xs]
p = prod(p_list)
assert 0.0 <= p <= 1.0
return p

Expand Down

0 comments on commit 27e36ef

Please sign in to comment.