-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Conversation
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.
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.
There was a problem hiding this 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
.
* 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)
* 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]>
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