-
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 setter so that SparsePauliOp.paulis.phase
stays zero
#12884
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
491f0e2
absorb `phase` into `coeffs` in `paulis()` setter
aeddins-ibm 2ff4fea
do not mutate input array
aeddins-ibm 8c5a322
add test that paulis setter absorbs phase
aeddins-ibm e5aad3c
lint
aeddins-ibm 836126e
If input paulis have phase, mutate and warn
aeddins-ibm 3d8fcbd
Merge branch 'main' into fix-sparsepauliop-phase
aeddins-ibm 8dd74d9
add release note
aeddins-ibm 50636fa
release-note formatting
aeddins-ibm 616e376
add test with `simplify()`
aeddins-ibm 71a752a
remove phase-warning from paulis setter
aeddins-ibm cdb74c9
lint
aeddins-ibm 058ba09
remove unused import
aeddins-ibm 3e91386
update reno
aeddins-ibm a5463e6
Merge branch 'main' into fix-sparsepauliop-phase
aeddins-ibm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
releasenotes/notes/fix-sparsepauliop-phase-bug-2b24f4b775ca564f.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
fixes: | ||
- | | ||
Fixed a bug when :attr:`.SparsePauliOp.paulis` is set to be a :class:`.PauliList` with nonzero | ||
phase, where subsequent calls to several :class:`.SparsePauliOp` methods would produce | ||
incorrect results. Now when :attr:`.SparsePauliOp.paulis` is set to a :class:`.PauliList` with | ||
nonzero phase, the phase is absorbed into :attr:`.SparsePauliOp.coeffs`, and the phase of the | ||
input :class:`.PauliList` is set to zero. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you also add a test to check the
simplify()
behavior you described in your original issue?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.
Added.