Skip to content

Commit

Permalink
union keys instead of entire dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsung committed Jan 8, 2024
1 parent 3a192cf commit dad9245
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/test_ffsim_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit dad9245

Please sign in to comment.