Closed
Description
Description of the issue
Following #2626 it was discussed that instead of always producing GateOperation
s, one should instead check that gate(*qubits).gate == gate
. However this fails for PauliStringPhasorGate:
gate = cirq.PauliStringPhasorGate(cirq.DensePauliString('XYZI', coefficient=(1+0j)), exponent_neg=0.2, exponent_pos=0.1)
op = gate.on(*cirq.LineQubit.range(4))
print(repr(op.gate))
prints
cirq.PauliStringPhasorGate(cirq.DensePauliString('XYZ', coefficient=(1+0j)), exponent_neg=0.2, exponent_pos=0.1)
The issues seems to be that DensePauliString#on drops the I.
dense = cirq.DensePauliString('XYZI', coefficient=(1+0j))`
print(repr(dense.on(*cirq.LineQubit.range(4))))
prints
(cirq.X(cirq.LineQubit(0))*cirq.Y(cirq.LineQubit(1))*cirq.Z(cirq.LineQubit(2)))
Cirq version
v0.15dev