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

Make optimize_1q_gates U and P aware #5429

Merged
merged 8 commits into from
Nov 26, 2020

Conversation

mtreinish
Copy link
Member

Summary

The optimize 1q gates pass currently only operates on u1, u2, u3 (or a
subset of that), however the u gate is interchangeable with the u3 gate
and the pass can be run if there is a u in the basis just as easily as
if it were a u3. This comes up for backends with over complete basis
sets, like Aer, which can have u and u3 in the same circuit. The
optimization pass will not simplify those gates despite it being
possible.

Details and comments

The optimize 1q gates pass currently only operates on u1, u2, u3 (or a
subset of that), however the u gate is interchangeable with the u3 gate
and the pass can be run if there is a u in the basis just as easily as
if it were a u3. This comes up for backends with overcomplete basis
sets, like Aer, which can have u and u3 in the same circuit. The
optimization pass will not simplify those gates despite it being
possible.
@mtreinish mtreinish added this to the 0.17 milestone Nov 24, 2020
@mtreinish mtreinish requested a review from a team as a code owner November 24, 2020 17:47
Just as U and U3 are interchangeable, U1 and P are also interchangeable.
This commit makes the same change to the Optimize1QGates pass done
earlier for supporting U for U1 and P so that if will work for a basis
where P is used instead of U1.
@mtreinish mtreinish changed the title Make optimize_1q_gates U aware Make optimize_1q_gates U and P aware Nov 25, 2020
@mtreinish mtreinish requested a review from kdk November 25, 2020 18:42
Copy link
Member

@kdk kdk left a comment

Choose a reason for hiding this comment

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

Changes look good. I wonder though if we still need Optimize1qGates now that we have Optimize1qDecompositions. As far as I know, the only missing feature from Optimize1qDecompositions is the U3->{U2,U1} simplification, but I don't see why this couldn't be added to the OneQubitEulerDecomposer.

@kdk kdk added the automerge label Nov 25, 2020
@mergify mergify bot merged commit 9e6a016 into Qiskit:master Nov 26, 2020
@mtreinish mtreinish deleted the make-optimize-1q-u-aware branch November 26, 2020 10:58
@mtreinish mtreinish added the stable backport potential The bug might be minimal and/or import enough to be port to stable label Jan 19, 2021
mergify bot pushed a commit that referenced this pull request Jan 19, 2021
* Make optimize_1q_gates U aware

The optimize 1q gates pass currently only operates on u1, u2, u3 (or a
subset of that), however the u gate is interchangeable with the u3 gate
and the pass can be run if there is a u in the basis just as easily as
if it were a u3. This comes up for backends with overcomplete basis
sets, like Aer, which can have u and u3 in the same circuit. The
optimization pass will not simplify those gates despite it being
possible.

* Make Optimize1QGates Phase gate aware too

Just as U and U3 are interchangeable, U1 and P are also interchangeable.
This commit makes the same change to the Optimize1QGates pass done
earlier for supporting U for U1 and P so that if will work for a basis
where P is used instead of U1.

* Fix lint

Co-authored-by: Kevin Krsulich <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 9e6a016)
mergify bot added a commit that referenced this pull request Jan 19, 2021
* Make optimize_1q_gates U aware

The optimize 1q gates pass currently only operates on u1, u2, u3 (or a
subset of that), however the u gate is interchangeable with the u3 gate
and the pass can be run if there is a u in the basis just as easily as
if it were a u3. This comes up for backends with overcomplete basis
sets, like Aer, which can have u and u3 in the same circuit. The
optimization pass will not simplify those gates despite it being
possible.

* Make Optimize1QGates Phase gate aware too

Just as U and U3 are interchangeable, U1 and P are also interchangeable.
This commit makes the same change to the Optimize1QGates pass done
earlier for supporting U for U1 and P so that if will work for a basis
where P is used instead of U1.

* Fix lint

Co-authored-by: Kevin Krsulich <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit 9e6a016)

Co-authored-by: Matthew Treinish <[email protected]>
@kdk kdk added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants