equal_up_to_global_phase()
depends on the order of its arguments for EigenGate
s
#5980
Labels
area/gates
good first issue
This issue can be resolved by someone who is not familiar with the codebase. A good starting issue.
kind/bug-report
Something doesn't seem to work.
triage/accepted
there is consensus amongst maintainers that this is a real bug or a reasonable feature to add
Description of the issue
the wrapping of the modulo operation in
EigenGate._equal_up_to_global_phase_
makes it dependent on the sign of the difference between the exponents. As a resultcirq.equal_up_to_global_phase()
depends on the ordering of its arguments when the two gates' exponents differ by a negligible factor (see below)i think all it would take to fix this is adding an
abs()
to the linked lines, e.g.:or alternatively replacing both with
linalg.tolerance.near_zero_mod()
How to reproduce the issue
Cirq version
1.2.0.dev20230105212249
The text was updated successfully, but these errors were encountered: