Cirq icon indicating copy to clipboard operation
Cirq copied to clipboard

equal_up_to_global_phase on gates doesn't work as expected

Open babacry opened this issue 1 year ago • 0 comments

Description of the issue Test cases

        (
            cirq.PhasedXPowGate(phase_exponent=1.5, exponent=1.0),
            cirq.PhasedXPowGate(phase_exponent=0.5, exponent=1.0),
            True,
        ),
        (cirq.XPowGate(exponent=2.0), cirq.I, True),

should pass the test suite IIUC?

If I apply equal_up_to_global_phase to matrices of gates, the test can pass:

cirq.equal_up_to_global_phase(cirq.PhasedXPowGate(phase_exponent=1.5, exponent=1.0),cirq.PhasedXPowGate(phase_exponent=0.5, exponent=1.0))

-> False

cirq.equal_up_to_global_phase(cirq.unitary(cirq.PhasedXPowGate(phase_exponent=1.5, exponent=1.0)),cirq.unitary(cirq.PhasedXPowGate(phase_exponent=0.5, exponent=1.0)))

-> True

How to reproduce the issue

Run the test cases above.

Cirq version

1.4.0.dev

babacry avatar Apr 24 '24 20:04 babacry