-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix setter so that
SparsePauliOp.paulis.phase
stays zero (#12884)
* absorb `phase` into `coeffs` in `paulis()` setter * do not mutate input array * add test that paulis setter absorbs phase * lint * If input paulis have phase, mutate and warn * add release note * release-note formatting * add test with `simplify()` * remove phase-warning from paulis setter * lint * remove unused import * update reno
- Loading branch information
1 parent
48cca36
commit 8c74a49
Showing
3 changed files
with
29 additions
and
0 deletions.
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