-
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.
Add grouping by full-operator commutation relations to PauliList (#7874)
* add group_inter_qubit_commuting * fix style lint of pauli_list.py * fix style lint * fix black format * update format * add test, docstring * reformat * adjust line length * adjust docstring format * adjust docstring format * adjust docstring format * update docstring and comment * add release note * Update documentation Co-authored-by: Jake Lishman <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
2b52def
commit 206ecd0
Showing
5 changed files
with
210 additions
and
30 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
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
20 changes: 20 additions & 0 deletions
20
...tes/notes/add-group-commuting-method-in-PauliList-and-SparsePauliOp-5dec2877c4a97861.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,20 @@ | ||
--- | ||
features: | ||
- | | ||
Added the methods :meth:`.PauliList.group_commuting` and :meth:`.SparsePauliOp.group_commuting`, | ||
which partition these operators into sublists where each element commutes with all the others. | ||
For example:: | ||
.. code-block:: python | ||
from qiskit.quantum_info import PauliList, SparsePauliOp | ||
groups = PauliList(["XX", "YY", "IZ", "ZZ"]).group_commuting() | ||
# 'groups' is [PauliList(['IZ', 'ZZ']), PauliList(['XX', 'YY'])] | ||
op = SparsePauliOp.from_list([("XX", 2), ("YY", 1), ("IZ", 2j), ("ZZ", 1j)]) | ||
groups = op.group_commuting() | ||
# 'groups' is [ | ||
# SparsePauliOp(['IZ', 'ZZ'], coeffs=[0.+2.j, 0.+1.j]), | ||
# SparsePauliOp(['XX', 'YY'], coeffs=[2.+0.j, 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