-
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
Fixed IQAE bug mentioned in issue 9280 #9887
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:
|
Hi @woodsp-ibm, I reopened a new PR with the same changes here since there were some issues in the history of PR #9289 that seemed challenging to resolve. |
releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml
Outdated
Show resolved
Hide resolved
LGTM but @jlapeyre could you also have a look? 🙂 |
@shifubear Thanks for sticking with this through the administrative difficulty. It looks fine to me. You may want to consider doing this instead qubits = [unitary.num_qubits]
qubits.extend(range(0, unitary.num_qubits))
qc = qc.compose(unitary_power, qubits) This is a significantly faster way to construct the list. In general, I advocate using an idiomatic best way to write something. In part because the code serves as a model for further development. Which way to write it is best?
Unfortunately, qc = qc.compose(unitary_power, [unitary.num_qubits].extend(range(0, unitary.num_qubits))) and you'd have something that is both faster and no less readable. But alas this is not the case. On balance, I favor the code as you have written in, with |
@jlapeyre Of course! Wanted to contribute so I'm glad there was a workaround. I prefer optimizing for readability in this instance, especially since the surrounding code is much slower as you mentioned. Also, my intuition is that the length of the qubits list will not be long enough for there to be a significant performance difference in the near future. |
I don't think there is a conceivable scenario where the performance of this line would matter in this method. Once the questions on the release note are addressed, I think this is good to go. |
…cea8251.yaml Co-authored-by: Julien Gacon <[email protected]>
Hi @jlapeyre, I added the suggested changes on the release notes! |
fixes: | ||
- | | ||
Fixed a bug where :class:`.IterativePhaseEstimation` was generating the wrong circuit, causing the | ||
algorithm to fail for simple cases. Fixed `#9280 https://github.com/Qiskit/qiskit-terra/issues/9280`__. |
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.
There should be a newline at the end of this file. The red circle warns about 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.
I added a newline but it looks like some tests are still failing. I can't seem to find what exactly is the cause. Do you have any pointers on how to find the error?
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.
Hi @shifubear, you should add angle brackets to your reno hyperlink definition, sphinx expects something like:
`reference_to_link_in_text <https://link.com>`__
releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml
Outdated
Show resolved
Hide resolved
…cea8251.yaml Co-authored-by: Elena Peña Tapia <[email protected]>
Pull Request Test Coverage Report for Build 4611005501
💛 - 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.
LGTM thanks for the fix!
* Fixed IQAE bug mentioned in issue 9280 * Update releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml Co-authored-by: Julien Gacon <[email protected]> * Added new line to release notes * Update releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml Co-authored-by: Elena Peña Tapia <[email protected]> --------- Co-authored-by: Julien Gacon <[email protected]> Co-authored-by: Steve Wood <[email protected]> Co-authored-by: Elena Peña Tapia <[email protected]>
* Fixed IQAE bug mentioned in issue 9280 * Update releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml Co-authored-by: Julien Gacon <[email protected]> * Added new line to release notes * Update releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml Co-authored-by: Elena Peña Tapia <[email protected]> --------- Co-authored-by: Julien Gacon <[email protected]> Co-authored-by: Steve Wood <[email protected]> Co-authored-by: Elena Peña Tapia <[email protected]>
* Fixed IQAE bug mentioned in issue 9280 * Update releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml Co-authored-by: Julien Gacon <[email protected]> * Added new line to release notes * Update releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml Co-authored-by: Elena Peña Tapia <[email protected]> --------- Co-authored-by: Julien Gacon <[email protected]> Co-authored-by: Steve Wood <[email protected]> Co-authored-by: Elena Peña Tapia <[email protected]>
* Fixed IQAE bug mentioned in issue 9280 * Update releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml Co-authored-by: Julien Gacon <[email protected]> * Added new line to release notes * Update releasenotes/notes/iterative-phase-estimation-bugfix-b676ffc23cea8251.yaml Co-authored-by: Elena Peña Tapia <[email protected]> --------- Co-authored-by: Julien Gacon <[email protected]> Co-authored-by: Steve Wood <[email protected]> Co-authored-by: Elena Peña Tapia <[email protected]>
Summary
Reopening a PR due to account conflicts present in PR #9289.
Details and comments
Fixed the bug mentioned in issue #9280, and added more tests to increase robustness for phase estimation algorithms.