-
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 {Pauli,SparsePauliOp}.apply_layout to raise an error with negative or duplicate indices #12385
Conversation
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.
Thanks, this seems like a good idea to me. Could you add a brief bug-fix release note mentioning the change?
Pull Request Test Coverage Report for Build 9030840979Details
💛 - Coveralls |
releasenotes/notes/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml
Outdated
Show resolved
Hide resolved
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.
Looks good, thanks for the quick change and the fix!
releasenotes/notes/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml
Outdated
Show resolved
Hide resolved
…e or duplicate indices (#12385) (#12386) * fix apply_layout to raise an error with negative or duplicate indices * reno * Fix Sphinx syntax * Fix my own Sphinx lookup problem --------- Co-authored-by: Jake Lishman <jake@binhbar.com> (cherry picked from commit fe275a0) Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
…e or duplicate indices (Qiskit#12385) * fix apply_layout to raise an error with negative or duplicate indices * reno * Fix Sphinx syntax * Fix my own Sphinx lookup problem --------- Co-authored-by: Jake Lishman <jake@binhbar.com>
Summary
{Pauli,SparsePauliOp}.apply_layout currently allow negative or duplicate indices.
The behavior is not always comprehensive.
This PR raises QiskitError with duplicate indices or negative indices (even within bounds for simplicity).
I think duplicate indices are not valid as a layout. But, if we need to support the pattern, we might need to update the code not to change the coefficients.
I noticed this situation when I review #12221 (comment)
main
this PR
Details and comments