-
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
fix 1q matrix bug in Quantum Shannon Decomposer #10126
Conversation
One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 5202288191
💛 - Coveralls |
I think this example from the bug report #10036 still fails with this commit qs_decomposition(qiskit.quantum_info.random_unitary(4).to_matrix()) Not only the 1q example fails, but some two qubit unitaries also result in an error. I think the fix given in the bug report looks like a correct fix: for some 2q input matrices |
I added a short fix and a test for a matrix that still failed with this PR, and made a PR to this PR branch ewinston#4 The matrix I used in the test is |
@jlapeyre Since the fix you and @jsmallz333 proposed works regardless of my approach maybe you should just submit that pr separately and I'll close this one. |
@ewinston , as we discussed out-of-band I think that it makes sense to include the commits you made in this PR as well. This will avoid calling the synthesis method in some cases where it can't do any good. Unless I misunderstand, I think you can just commit ewinston#4 in order to include the commits that fix the bug proper. If you prefer separating the PRs, I'm fine with making a separate PR as you suggest above. |
Co-authored-by: jsmallz333 <90203920+jsmallz333@users.noreply.github.com>
Add check that decomposition includes qsd2q gates before optimizing them
This looks good to go. But I think someone other than me should merge, since I added a commit to this PR. |
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.
This LGTM, I just have a small nit inline about the comments. I'm going to apply the suggestion and enqueue for merging. (I forgot about the missing release note).
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.
Oh, I also forgot about a release note. Would you mine adding one so we can document we fixed this in the next bugfix release.
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Yes, of course. I forgot too. This is done in a PR to this PR branch ewinston#5 |
Thanks @jlapeyre |
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.
This LGTM, but I think it's still missing a release note to cover the bug fix
I pushed a new commit to |
This was requested in a review comment.
Add release note for fix to issue 10036
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 adding the release note.
* fix 1q bug * formatting * restrict 2q gates from apply_a2 * Add check that decomposition includes qsd2q gates before optimizing them Co-authored-by: jsmallz333 <90203920+jsmallz333@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * Add release note for fix to issue 10036 * avoid creating unitary gate if initial gate is 2q * remove debug code * Change "certain" to "trivial" This was requested in a review comment. --------- Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com> Co-authored-by: jsmallz333 <90203920+jsmallz333@users.noreply.github.com> Co-authored-by: Matthew Treinish <mtreinish@kortar.org> (cherry picked from commit b831bcf)
* fix 1q bug * formatting * restrict 2q gates from apply_a2 * Add check that decomposition includes qsd2q gates before optimizing them Co-authored-by: jsmallz333 <90203920+jsmallz333@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Matthew Treinish <mtreinish@kortar.org> * Add release note for fix to issue 10036 * avoid creating unitary gate if initial gate is 2q * remove debug code * Change "certain" to "trivial" This was requested in a review comment. --------- Co-authored-by: John Lapeyre <jlapeyre@users.noreply.github.com> Co-authored-by: jsmallz333 <90203920+jsmallz333@users.noreply.github.com> Co-authored-by: Matthew Treinish <mtreinish@kortar.org> (cherry picked from commit b831bcf) Co-authored-by: ewinston <ewinston@us.ibm.com>
Summary
Fixes #10036
Details and comments