Skip to content

CZTargetGateset: PhysicalZ op gets decomposed when additional_gates contains a PhysicalZ GateFamily #5783

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

Closed
verult opened this issue Jul 15, 2022 · 1 comment
Assignees
Labels
area/gatesets kind/bug-report Something doesn't seem to work.

Comments

@verult
Copy link
Collaborator

verult commented Jul 15, 2022

Description of the issue

Expected cirq.Z to not decompose into cirq.PhasedXZGate in the code snippet below (probably the same issue in other target gatesets as well):

How to reproduce the issue

>>> cirq.optimize_for_target_gateset(
...     cirq.Circuit(cirq.Z(cirq.LineQubit(0)).with_tags(cg.PhysicalZTag())),
...     gateset=cirq.CZTargetGateset(additional_gates=[cirq.GateFamily(cirq.ZPowGate, tags_to_accept=[cg.PhysicalZTag()])])
... )
cirq.Circuit([
    cirq.Moment(
        cirq.PhasedXZGate(axis_phase_exponent=0.0, x_exponent=0.0, z_exponent=1.0).on(cirq.LineQubit(0)),
    ),
])

Are we checking only the gate and not the operation when decomposing?

@tanujkhattar

@verult verult added kind/bug-report Something doesn't seem to work. area/gatesets labels Jul 15, 2022
@verult
Copy link
Collaborator Author

verult commented Jul 16, 2022

My bad, the example given above isn't an issue because CZTargetGateset ejects Paulis as expected. The actual code that failed was this:

cirq.optimize_for_target_gateset(
     cirq.Circuit(
                cirq.Z(_qa).with_tags(cirq_google.PhysicalZTag()) ** 0.5, cirq.CZ(_qa, _qb)
     ),
     gateset=cirq.CZTargetGateset(additional_gates=[cirq.GateFamily(cirq.ZPowGate, tags_to_accept=[cg.PhysicalZTag()])])
)

This fails because raising the whole operation to an exponent removes all tags, which is a separate issue but not related to target gatesets.

@verult verult closed this as completed Jul 16, 2022
@verult verult closed this as not planned Won't fix, can't repro, duplicate, stale Jul 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gatesets kind/bug-report Something doesn't seem to work.
Projects
None yet
Development

No branches or pull requests

2 participants