-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
-
We have many different ways of specifying the same gate. An X gate could an instance of
PauliString
, ofXPowGate
, ofPhasedXPowGate
, of (in the future)PhasedXZPowGate
, ofMatrixGate
, you get the idea. It would be nice if I could just saycirq.match(might_be_x, cirq.X)
in order to recognize X gates, andcirq.match(might_be_x, cirq.XPowGate)
to identify X rotations. -
I always accidentally write
if isinstance(op, GateType)
instead ofif isinstance(op.gate, GateType)
and then lose ten minutes figuring out what's wrong. It would be nice if this was not a possible mistake to make, e.g.if cirq.match(op, cirq.IdentityGate)
worked and alsoif cirq.match(gate, cirq.IdentityGate)
worked. -
Currently, in order to identify an identity operation from an
Any
you have to sayif isinstance(obj, cirq.Operation) and isinstance(obj.gate, cirq.IdentityGate)
. It would be nice if this had noand
in it, e.g.if cirq.match(obj, cirq.IdentityGate):
. -
I often want matching to be approximate. For example,
PhasedXPowGate(exponent=0.2, phase_exponent=1e-10)
should match intoXPowGate
when tolerance is larger than 1e-10.