-
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 a corner case of SparsePauliOp.apply_layout
#12375
Conversation
One or more of the the following people are requested to review this:
|
6c8349f
to
f221ceb
Compare
Pull Request Test Coverage Report for Build 9081444739Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
f221ceb
to
4caca25
Compare
I noticed that I have to fix Pauli as well. |
4caca25
to
23dde22
Compare
I confirmed that the current Pauli.apply_laytout works correctly. So, we don't have to update it. I just added tests to ensure it. |
23dde22
to
5cdaf81
Compare
Looks good although maybe could be made briefer using |
Thank you for your suggestion, Erick. I simplified this PR with |
releasenotes/notes/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml
Show resolved
Hide resolved
* fix a corner case of `SparsePauliOp.apply_layout` * Add zero-qubit tests of Pauli.apply_layout * use combine and apply isort * Update releasenotes/notes/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org> (cherry picked from commit cea93a0)
* fix a corner case of `SparsePauliOp.apply_layout` * Add zero-qubit tests of Pauli.apply_layout * use combine and apply isort * Update releasenotes/notes/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org> (cherry picked from commit cea93a0) Co-authored-by: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
* fix a corner case of `SparsePauliOp.apply_layout` * Add zero-qubit tests of Pauli.apply_layout * use combine and apply isort * Update releasenotes/notes/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml --------- Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
Summary
SparsePauliOp.apply_layout
raises an error if a zero-qubit operator is given.This PR fixes the case.
main branch
this PR
Although
Pauli.apply_layout
works correctly, I added the zero-qubit test cases to ensure it.Details and comments