Cirq
Cirq copied to clipboard
phase exponent ignored in approximate comparisons of `cirq.PhasedISwapPowGate`
Description of the issue
PhasedISwapPowGate doesn't override the _value_equality_approximate_values_ implementation it inherits from EigenGate, which means its phase exponent attribute isn't included in approximate comparisons
the one exception is when its phase exponent is zero, in which case approximate comparison fails even when it shouldn't due to some of the same inconsistencies described for cirq.PhasedXPowGate in #6528
How to reproduce the issue
gate0 = cirq.PhasedISwapPowGate(phase_exponent=0)
gate1 = cirq.PhasedISwapPowGate(phase_exponent=1e-12)
gate2 = cirq.PhasedISwapPowGate(phase_exponent=2e-12)
gate3 = cirq.PhasedISwapPowGate(phase_exponent=0.345)
assert cirq.approx_eq(gate1, gate2) # ok
assert cirq.approx_eq(gate1, gate0) # fails, even though they are as close as the previous two
assert cirq.approx_eq(gate1, gate3) # passes, but shouldn't
assert cirq.equal_up_to_global_phase(gate1, gate2) # ok
assert cirq.equal_up_to_global_phase(gate1, gate0) # fails, even though they are as close as the previous two
assert cirq.equal_up_to_global_phase(gate1, gate3) # passes, but shouldn't
Cirq version
1.4.0.dev20240209232305
This is Eric from sync please assign me issue and hello everyone!
Hello is this still open ? Am interested