From fe4e5129c2f040b18c5b843cf06dd1287559691e Mon Sep 17 00:00:00 2001 From: MarcSerraPeralta <43704266+MarcSerraPeralta@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:33:11 +0200 Subject: [PATCH] Faster `qec_util.performance.sample_failures` (#39) --- qec_util/performance/sampler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qec_util/performance/sampler.py b/qec_util/performance/sampler.py index 340dc99..ab04bee 100644 --- a/qec_util/performance/sampler.py +++ b/qec_util/performance/sampler.py @@ -72,7 +72,6 @@ def sample_failures( if "decode_batch" not in dir(decoder): raise TypeError("'decoder' does not have a 'decode_batch' method.") - sampler = dem.compile_sampler() num_failures, num_samples = 0, 0 if (file_name is not None) and pathlib.Path(file_name).exists(): @@ -82,6 +81,7 @@ def sample_failures( return num_failures, num_samples # estimate the batch size for decoding + sampler = dem.compile_sampler() defects, log_flips, _ = sampler.sample(shots=100) t_init = time.time() predictions = decoder.decode_batch(defects)