-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix PauliString.pass_operations_over
not supporting common gates
#2351
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
Conversation
- Add `_decompose_into_clifford_` method to `GateOperation` - Add `_decompose_into_clifford_with_qubits_` method to several common gates - Add `PauliString.conjugated_by`, which accepts an `OP_TREE` defining a composite Clifford operation in Circuit order. This differs from `pass_ops_over`, because `pass_ops_over` which takes a list of operations in reverse circuit order (which is confusing). - Fix op_gate_isinstance type annotation not allowing type tuples - Add `PauliString.dense` method Code such as the following now works: ``` a, b = cirq.LineQubit.range(2) print(cirq.X(a).pass_operations_over([cirq.H(a)])) print(cirq.X(a).conjugated_by([cirq.H(a), cirq.CNOT(a, b)])) ``` ``` Z(0) Z(0)*X(1) ``` Fixes #2179
Reviewers: please check that |
I'm excited for The various decompose methods: this seems like it could be simplified/generalized with the long-talked-about notion of gatesets |
Yes, I kept the decompose methods private without a publicly exposed method because I didn't want to commit to the interface yet. |
is anything blocking this? |
@mpharrigan Nothing except actually getting a review of it. |
# Conflicts: # cirq/ops/common_gates.py # cirq/ops/gate_operation.py # cirq/ops/pauli_string.py
_decompose_into_clifford_
method toGateOperation
_decompose_into_clifford_with_qubits_
method to several common gatesPauliString.conjugated_by
, which accepts anOP_TREE
defining a composite Clifford operation in Circuit order. This differs frompass_ops_over
, becausepass_ops_over
takes a list of operations in reverse circuit order (which is confusing).PauliString.dense
methodCode such as the following now works:
Fixes #2179