pauli_string
¶
Multi-qubit Pauli strings.
PauliString
¶
Tensor product of single-qubit Paulis on n qubits.
Indexing matches the string order: the leftmost character acts on qubit 0,
so PauliString.from_string("XYZ") corresponds to X ⊗ Y ⊗ Z.
Source code in shadowsim/core/pauli_string.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
__init__
¶
__init__(paulis: Sequence[Pauli]) -> None
Initialize a PauliString from an ordered sequence of Paulis.
Source code in shadowsim/core/pauli_string.py
from_string
classmethod
¶
Build a PauliString from a label string such as XYZ.
Source code in shadowsim/core/pauli_string.py
matrix
¶
Return the tensor-product matrix of this Pauli string.
__len__
¶
__str__
¶
__repr__
¶
__eq__
¶
Return whether this PauliString equals another.
__hash__
¶
multiply
¶
Multiply Pauli strings: self * other = phase * result.
Multiplication is qubit-by-qubit in matching order (leftmost = qubit 0).
Source code in shadowsim/core/pauli_string.py
commutator
¶
Return [self, other] as coeff * R, or (None, None) if zero.
Uses P Q - Q P: for Pauli strings this is either 0 or
2 * (phase from P*Q) * R with an odd number of pairwise
anticommuting single-qubit factors.