From f015f4959b6a74b46d430551f36d64891c5b6651 Mon Sep 17 00:00:00 2001 From: Ben <16917183+bencrts@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:27:52 +0000 Subject: [PATCH] perf(simulator): speed-up GSA computation --- estimator/simulator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/estimator/simulator.py b/estimator/simulator.py index ad1c5bd3..cea8629f 100644 --- a/estimator/simulator.py +++ b/estimator/simulator.py @@ -107,7 +107,8 @@ def GSA(d, n, q, beta, xi=1, tau=1, dual=False): log_vol = RR(log(q, 2) * (d - n - 1) + log(xi, 2) * n + log(tau, 2)) delta = deltaf(beta) - r_log = [(d - 1 - 2 * i) * RR(log(delta, 2)) + log_vol / d for i in range(d)] + log_delta = RR(log(delta, 2)) + r_log = [(d - 1 - 2 * i) * log_delta + log_vol / d for i in range(d)] r = [2 ** (2 * r_) for r_ in r_log] return r