Skip to content

Commit

Permalink
test for approximate equality in equal circuits
Browse files Browse the repository at this point in the history
this is needed since the `cirq.inverse` function can introduce tiny
deviations (on the order of 1e-15) when computing the inverses of matrix
gates. exact equality is awesome, but some numerical inacuracy here
seems inevitable
  • Loading branch information
natestemen committed Dec 14, 2023
1 parent c311a81 commit 8b55aab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mitiq/benchmarks/tests/test_mirror_qv_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_generate_model_circuit_with_seed():
circuit_2 = generate_mirror_qv_circuit(4, 3, seed=1)
circuit_3 = generate_mirror_qv_circuit(4, 3, seed=2)

assert circuit_1 == circuit_2
assert cirq.approx_eq(circuit_1, circuit_2, atol=1e-12)
assert circuit_2 != circuit_3


Expand Down

0 comments on commit 8b55aab

Please sign in to comment.