-
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 wrong argument supplied to _identity_op() #9201
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
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 looks correct, thanks for the quick response! Please could you also add a test in the file test/python/circuit/test_commutation_checker.py
that we get a correct result - something like
from qiskit.circuit import CommutationChecker, Qubit
from qiskit.circuit.library import XGate
qargs = [Qubit() for _ in [None]*8]
CommutationChecker().commute(XGate(), qargs[:1], [], XGate().control(7), qargs, [])
should be False
, for example, and will completely blow up Numpy without your fix. You could write a test about that.
We also need to add a short release note - if you've done pip install reno
already, you should be able to run reno new --edit fix-commutation-checker-size
and remove everything but the fixes
section (and write a sentence there briefly explaining what was fixed).
Pull Request Test Coverage Report for Build 4307516998
💛 - Coveralls |
Okay, is there any naming convention for these test cases? And I guess all the methods in the QiskitTestCase are called automatically so I can simply add a new method? |
Sorry for the delay in responding here. As long as the method name starts with |
Hi, I didn't get to work on this any sooner. I now added a simple unit test and release note. I wanted to merge the upstream changes to my repo to be able to push my changes. Apparently I pressed the wrong button now, sorry for that. |
A "detached HEAD" state in git means you've just got a commit checked out that isn't the end point of any branch. If you've not got any changes in your working directory, you can just If you've got the changes you want to push in your local copy right now, but
Ideally this will just update your local branch with the changes that have happened to the remote on GitHub, and then you'll just be able to run Don't worry - there's nothing you can do that can break our side of things, and the worst that can possibly happen is that your branch gets too messed up, and then we can close this and you can just make a new pull request. |
This commit adds a test case to ensure we get the correct result with a large number of qubits. This also implicitly tests that we've fixed the excessive memory consumption because the memory requirements for an 8 qubit gate with the bug still present would not be runnable on most current systems. Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
To unblock this since the same bug being fixed by this was reported again in #9693 I pushed up the test proposed by @jakelishman and also added a release note. |
* Fix wrong argument supplied to _identity_op() #9197 * Add test case with large qubit gate This commit adds a test case to ensure we get the correct result with a large number of qubits. This also implicitly tests that we've fixed the excessive memory consumption because the memory requirements for an 8 qubit gate with the bug still present would not be runnable on most current systems. Co-authored-by: Jake Lishman <jake.lishman@ibm.com> * Add release note --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 992d74f)
* Fix wrong argument supplied to _identity_op() #9197 * Add test case with large qubit gate This commit adds a test case to ensure we get the correct result with a large number of qubits. This also implicitly tests that we've fixed the excessive memory consumption because the memory requirements for an 8 qubit gate with the bug still present would not be runnable on most current systems. Co-authored-by: Jake Lishman <jake.lishman@ibm.com> * Add release note --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 992d74f) Co-authored-by: M St <25572273+mstnb@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Fix wrong argument supplied to _identity_op() Qiskit#9197 * Add test case with large qubit gate This commit adds a test case to ensure we get the correct result with a large number of qubits. This also implicitly tests that we've fixed the excessive memory consumption because the memory requirements for an 8 qubit gate with the bug still present would not be runnable on most current systems. Co-authored-by: Jake Lishman <jake.lishman@ibm.com> * Add release note --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org> Co-authored-by: Jake Lishman <jake.lishman@ibm.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Summary
This fixes a typo in the CommutationChecker where 2**num_qubits was passed to _identity_op instead of num_qubits.
Details and comments
Fixes #9197.