Skip to content

FSim and PhasedFSim angles should be canonicalized between (-pi, pi] / [-pi, pi) instead of [-pi, pi] #4574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tanujkhattar opened this issue Oct 13, 2021 · 0 comments · Fixed by #4576
Labels
area/gates kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on

Comments

@tanujkhattar
Copy link
Collaborator

Description of the issue
Right now, cirq.FSimGate and cirq.PhasedFSimGate canonicalize their angles between [-pi, pi], which was done as part of #3542.

The problem with this approach is that we need to implement additional logic at the call site to check whether two instances of FSimGate are equal, instead of simply using the equality operator.

We should modify the canonicalization to be open on one of the boundaries so that the comparison at call sites can simply rely on the default value equality.

How to reproduce the issue

>>> op1, op2 = cirq.FSimGate(0, np.pi), cirq.FSimGate(0, -np.pi)
>>> op1 == op2, np.allclose(cirq.unitary(op1), cirq.unitary(op2))
(False, True)

Cirq version
0.13.0dev

@tanujkhattar tanujkhattar added kind/bug-report Something doesn't seem to work. area/gates labels Oct 13, 2021
@viathor viathor added the triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on label Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gates kind/bug-report Something doesn't seem to work. triage/accepted A consensus emerged that this bug report, feature request, or other action should be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants