From dad92458ed2664888594b27c5a75306fb8a5665f Mon Sep 17 00:00:00 2001 From: "Kevin J. Sung" Date: Sun, 7 Jan 2024 21:12:39 -0500 Subject: [PATCH] union keys instead of entire dictionary --- test/test_ffsim_backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_ffsim_backend.py b/test/test_ffsim_backend.py index cac74c3..5020abf 100644 --- a/test/test_ffsim_backend.py +++ b/test/test_ffsim_backend.py @@ -52,7 +52,7 @@ def _fidelity(counts1: dict[str, int], counts2: dict[str, int]) -> float: result = 0 shots = sum(counts1.values()) assert sum(counts2.values()) == shots - for bitstring in counts1 | counts2: + for bitstring in counts1.keys() | counts2.keys(): prob1 = counts1.get(bitstring, 0) / shots prob2 = counts2.get(bitstring, 0) / shots result += math.sqrt(prob1 * prob2)