-
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
Merge paramterized u1, u2 and p gate in Optimize1qGates #7579
Conversation
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.
I'm a bit confused by this PR, it looks identical to #7309 except you've added the release note I asked for in my review yesterday. To add the release note there is no need to open a new pull request you can just modify the existing branch for #7309. It's generally better to use the existing PR so the entire review history is present and the merged commit refers to the single place where all the review happened.
@mtreinish you are absolutely right. I'm unable to add release notes to PR because I'm also working on the @nbronn fork of terra and GitHub lost the connection between my code and the last PR. Therefore I've created a new one with exactly the same code with the release notes added. Sorry for confusion. |
Pull Request Test Coverage Report for Build 1762015271
💛 - Coveralls |
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.
It looks like some of the revisions made on #7309 didn't make it through the transition to this new PR. I also left some inline improvement suggestions on the release note. Mostly around som sphinx rst syntax fixes and some mild rewording.
releasenotes/notes/optimization-u2-gates-with-parameters-322b6c523251108c.yaml
Outdated
Show resolved
Hide resolved
…c523251108c.yaml Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
@mtreinish I've added those changes. |
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.
LGTM, thanks for keeping with this and making the updates
Summary
Before the fix, the 'Optimize1qGates' transpiler optimization join together the gate only when the parameter was bounded (or when there was no parameter at all). After the fix, the u1, u2, and p gates will be combined even when the parameter is unbounded.
from qiskit import QuantumCircuit
from qiskit.circuit import Parameter
from qiskit.transpiler import PassManager
from qiskit.transpiler.passes import Optimize1qGates, Unroller
phi = Parameter('φ')
alpha = Parameter('α')
qc = QuantumCircuit(1)
qc.u1(2*phi, 0)
qc.u1(alpha, 0)
qc.u1(0.1, 0)
qc.u1(0.2, 0)
qc.draw(output='mpl')
pm = PassManager([Unroller(['u1', 'cx']), Optimize1qGates()])
nqc = pm.run(qc)
nqc.draw(output='mpl')
This change is a part of the advocate project done under @nbronn.
This is continuation of the issue #7309