Skip to content
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

Adds default decompositions for cirq.MatrixGate into X/Y/Z/CZ target gateset. #5088

Merged

Conversation

tanujkhattar
Copy link
Collaborator

@tanujkhattar tanujkhattar requested review from a team, vtomole and cduck as code owners March 16, 2022 23:39
@tanujkhattar tanujkhattar requested a review from viathor March 16, 2022 23:39
@CirqBot CirqBot added the size: M 50< lines changed <250 label Mar 16, 2022
@tanujkhattar tanujkhattar added the priority/high This is something that should get done soon, e.g. within a month. label Mar 16, 2022
Copy link
Collaborator

@MichaelBroughton MichaelBroughton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the controlled gate stuff leaked into this PR as well. The MatrixGate stuff looks good though.

@tanujkhattar
Copy link
Collaborator Author

It looks like the controlled gate stuff leaked into this PR as well. The MatrixGate stuff looks good though.

Nope, it needs to be done here because right now, the default decomposition of a controlled gate decomposes the underlying sub_gate, if it can, and then returns a controlled version of every decomposed gate. Decompositions of Matrix Gate ignores global phase, and therefore we need to add a special case to controlled gates to not fall back on the default decomposition of sub_gate if the sub_gate is a matrix gate, because global phase becomes local phase in this setting and cannot be ignored.

@tanujkhattar tanujkhattar merged commit ded5d17 into quantumlib:master Mar 17, 2022
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
…t gateset. (quantumlib#5088)

* Add default decompositions for cirq.MatrixGate

* Add special case to handle MatrixGate as a sub gate in ControlledGate
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
…t gateset. (quantumlib#5088)

* Add default decompositions for cirq.MatrixGate

* Add special case to handle MatrixGate as a sub gate in ControlledGate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/high This is something that should get done soon, e.g. within a month. size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants