Skip to content

PauliStringPhasorGate does not round trip via operation and gate method. #5167

Closed
@dabacon

Description

@dabacon

Description of the issue

Following #2626 it was discussed that instead of always producing GateOperations, 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

Metadata

Metadata

Assignees

Labels

area/gateskind/bug-reportSomething doesn't seem to work.triage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions