Merge `cirq.Pauli.X` and `cirq.X` into one object (do same for Y and Z)
See original GitHub issueCurrently, there is an unnecessary distinction between cirq.Pauli.X
(an instance of cirq.Pauli
) and cirq.X
(an instance of cirq.RotXGate
). Some code wants the pauli x, some wants the x rotation. We need to unify these two things into one thing.
I’m not exactly sure how this should be done.
One way would be to introduce a PauliXGate
that is the unification of both concepts, and falls back into one or the other as methods are applied (e.g. cirq.X would be a PauliGate but cirq.X**0.5 would again be a RotXGate).
Another way is to destroy the Pauli
class and replace it with a type such as Union[cirq.X, cirq.Y, cirq.Z]
, and all the class methods because just functions that can be applied to that type.
I’m labelling this “good part time project” because I think it’s reasonably “meaty” design-wise and amount-of-touched-code-wise. I expect it to require iteration to hit something that works well.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Some example use cases that I think should work:
Creating and exponentiating pauli products to create
PauliStringPhasor
operations that can be put into a circuit:The future possibility of creating linear combinations of pauli products, which defines a
QubitOperator
(a term from openfermion):Clarification on the status of
cirq.Pauli
: it still exists, but as abstract class. It has no public subclasses and only three instances:cirq.X
,cirq.Y
andcirq.Z
, see #1249.The class is used in type annotations and for its static methods that enable index-based access to the three instances, e.g. in the definition of
SingleQubitCliffordGate
class.