-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Handle inverse for Quil's SWAP gate #5341
Conversation
cirq-core/cirq/ops/swap_gates.py
Outdated
@@ -143,7 +143,7 @@ def _qasm_(self, args: 'cirq.QasmArgs', qubits: Tuple['cirq.Qid', ...]) -> Optio | |||
def _quil_( | |||
self, qubits: Tuple['cirq.Qid', ...], formatter: 'cirq.QuilFormatter' | |||
) -> Optional[str]: | |||
if self._exponent == 1: | |||
if self._exponent == 1 or self._exponent == -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is _exponent
restricted in any way? If not, I think this should be any odd power. i.e. if self._exponent % 2 == 1:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it's restricted but your suggestion makes this more robust so i did it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Happy acquisition announcement day!
@dabacon Thanks!! |
`SWAP` is it's own self inverse. Fixes: quantumlib#5310
`SWAP` is it's own self inverse. Fixes: quantumlib#5310
SWAP
is it's own self inverse. Fixes: #5310