-
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 a corner case of
SparsePauliOp.apply_layout
(#12375)
* 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>
- Loading branch information
1 parent
fe69594
commit cea93a0
Showing
4 changed files
with
58 additions
and
25 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
10 changes: 10 additions & 0 deletions
10
releasenotes/notes/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.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,10 @@ | ||
fixes: | ||
- | | ||
Fixed :meth:`.SparsePauliOp.apply_layout` to work correctly with zero-qubit operators. | ||
For example, if you previously created a 0 qubit and applied a layout like:: | ||
op = SparsePauliOp("") | ||
op.apply_layout(None, 3) | ||
this would have previously raised an error. Now this will correctly return an operator of the form: | ||
``SparsePauliOp(['III'], coeffs=[1.+0.j])`` |
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
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