Python API¶
The factories PauliString and PauliStringSum pick the numeric or the
symbolic class from the coefficient types, and for low-weight operators on many
qubits the sparse class (SparsePauliStringComplex, SparsePauliStringSumComplex
and their symbolic variants; see set_sparse_threshold); the classes below are
what they return. isinstance(x, pauliengine.PauliString) and
isinstance(x, pauliengine.PauliStringSum) accept all of them. The sparse
classes have the same methods as the ones with bit vectors, plus to_dense(),
fits_sparse() and, for strings, sites.
Pauli strings¶
- class pauliengine.pauli_string.PauliStringFactory(name, builders)[source]¶
Bases:
objectFactory behind
pauliengine.PauliString.Builds a
PauliStringComplexfor a numeric coefficient, aPauliStringSymbolicfor a string coefficient and anunweighted_pauliStringwithout a coefficient, and accepts several formats for the Pauli operators.isinstance(x, PauliString)is true for every weighted Pauli string, complex or symbolic, with bit vectors or sparse; anunweighted_pauliStringhas no coefficient and is not one.- Parameters:
name (str)
builders (dict[type, type])
- __init__(name, builders)[source]¶
Create the factory;
buildersmaps coefficient types to classes.- Parameters:
name (str)
builders (dict[type, type])
- Return type:
None
- from_hash(hash, coeff=1)[source]¶
Inverse of
get_hash(): the Pauli string with that operator part.The coefficient type selects the class exactly as in
__call__.- Parameters:
hash (int)
coeff (complex | str)
- Return type:
- to_complex(expr)[source]¶
Evaluate a fully numeric symbolic coefficient to a complex number.
- Raises:
RuntimeError – If
exprstill contains free symbols.- Parameters:
expr (Expression)
- Return type:
complex
- class pauliengine._core.PauliStringComplex(*args, **kwargs)¶
Bases:
objectA Pauli string with a complex coefficient, stored in binary symplectic form (x and y bit vectors).
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Add two PauliStringComplex to get PauliStringSumComplex
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Add PauliStringComplex and PauliStringSymbolic to get PauliStringSumSymbolic
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __eq__(self, arg: pauliengine._core.PauliStringComplex, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliStringSymbolic, /) bool
- __eq__(self, arg: pauliengine._core.SparsePauliStringComplex, /) bool
- __eq__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliStringComplex, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __hash__(self) int¶
Hash over the operator part (x, y); ignores the coefficient.
- __init__(self) None¶
- __init__(self, arg0: complex, arg1: collections.abc.Mapping[int, str], /) None
- __init__(self, arg: tuple[complex, collections.abc.Sequence[tuple[str, int]]], /) None
- __init__(self, arg0: complex, arg1: str, /) None
Overloaded function.
__init__(self) -> None
The zero Pauli string (identity operator, coefficient 0).
__init__(self, arg0: complex, arg1: collections.abc.Mapping[int, str], /) -> None
From a complex coefficient and a map {qubit: ‘X’/’Y’/’Z’/’I’}.
__init__(self, arg: tuple[complex, collections.abc.Sequence[tuple[str, int]]], /) -> None
From an OpenFermion-style pair (coefficient, [(‘X’, qubit), …]).
__init__(self, arg0: complex, arg1: str, /) -> None
From a complex coefficient and a text: dense such as ‘XIZ’ (character i acts on qubit i) or sparse such as ‘X0 Z2’.
- __len__(self) int¶
Number of qubits with a non-identity operator (the weight).
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringComplex¶
- __mul__(self, arg: float, /) pauliengine._core.PauliStringComplex
- __mul__(self, arg: int, /) pauliengine._core.PauliStringComplex
- __mul__(self, arg: complex, /) pauliengine._core.PauliStringComplex
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringComplex
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliStringSymbolic
Overloaded function.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringComplex
Product of two Pauli strings, including the phase of the Pauli algebra.
__mul__(self, arg: float, /) -> pauliengine._core.PauliStringComplex
The Pauli string scaled by a float.
__mul__(self, arg: int, /) -> pauliengine._core.PauliStringComplex
The Pauli string scaled by a int.
__mul__(self, arg: complex, /) -> pauliengine._core.PauliStringComplex
The Pauli string scaled by a complex number.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSymbolic
Product with a symbolic Pauli string; the result is symbolic.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliStringSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Subtract two PauliStringComplex to get PauliStringSumComplex
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Subtract PauliStringComplex and PauliStringSymbolic to get PauliStringSumSymbolic
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- anticommutes(self, other: pauliengine._core.PauliStringComplex) bool¶
True if the strings anti-commute.
- commutator(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringComplex¶
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringComplex
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumComplex
Overloaded function.
commutator(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringComplex
Commutator [self, other] = self*other - other*self (a single Pauli string, zero if they commute).
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- copy(self) pauliengine._core.PauliStringComplex¶
An independent copy of the Pauli string.
- count_y(self) int¶
Number of Y operators in the Pauli string.
- equals(self, arg: pauliengine._core.PauliStringComplex, /) bool¶
True if the operators are equal, ignoring the coefficients.
- get_coeff(self) complex¶
The coefficient of the Pauli string.
- get_hash(self) int¶
Invertible int key of the operator part (coefficient ignored): sum_q p_q * 4**q with I=0, X=1, Y=2, Z=3.
- get_pauli_at_index(self, arg: int, /) str¶
Pauli operator (‘I’, ‘X’, ‘Y’ or ‘Z’) on the given qubit.
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_all_z(self) int¶
True if every non-identity operator is Z.
- key_openfermion(self) list[tuple[str, int]]¶
OpenFermion-style key: list of (Pauli, qubit) pairs of the non-identity sites, sorted by qubit.
- map_qubits(self, arg: collections.abc.Mapping[int, int], /) pauliengine._core.PauliStringComplex¶
Copy with qubit indices remapped by {old: new}; an occupied target that is not itself remapped is swapped.
- naked(self) pauliengine._core.PauliStringComplex¶
Copy of the Pauli string with coefficient 1.
- qubits(self) list[int]¶
Sorted list of the qubits with a non-identity operator.
- set_coeff(self, arg: complex, /) None¶
Replace the coefficient (in place) by a complex number.
- size(self) int¶
Number of qubits with a non-identity operator (the weight).
- targeted_commutator(self, other: pauliengine._core.PauliStringComplex, target: pauliengine._core.PauliStringComplex) complex¶
Coefficient of target’s operator in [self, other] (0 if absent); target’s coefficient is ignored.
- to_dictionary(self) tuple[complex, dict[int, str]]¶
The Pauli string as a (coefficient, {qubit: ‘X’/’Y’/’Z’}) pair.
- to_string(self) str¶
Human-readable form, e.g. ‘1.000000 + 0.000000i : X(0)Z(2)’.
- trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], /) pauliengine._core.PauliStringComplex¶
- trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[tuple[complex, complex]], /) pauliengine._core.PauliStringComplex
Overloaded function.
trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], /) -> pauliengine._core.PauliStringComplex
Project onto a computational-basis state of the listed qubits (state[i] in {0, 1}).
trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[tuple[complex, complex]], /) -> pauliengine._core.PauliStringComplex
Project onto general single-qubit states (a, b) representing a|0>+b|1> per traced qubit.
- property coeff¶
The coefficient of the Pauli string (read-only).
- from_hash = <nanobind.nb_func object>¶
- property is_zero¶
True if the coefficient is zero.
- property x¶
x bits as 64-bit words (bit q set for X or Z on qubit q).
- property y¶
y bits as 64-bit words (bit q set for Y or Z on qubit q).
- class pauliengine._core.PauliStringSymbolic(*args, **kwargs)¶
Bases:
objectA Pauli string with a symbolic (polynomial) coefficient, stored in binary symplectic form (x and y bit vectors).
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic¶
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Add two PauliStringSymbolic to get PauliStringSumSymbolic
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Add PauliStringSymbolic and PauliStringComplex to get PauliStringSumSymbolic
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __eq__(self, arg: pauliengine._core.PauliStringSymbolic, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliStringComplex, /) bool
- __eq__(self, arg: pauliengine._core.SparsePauliStringComplex, /) bool
- __eq__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.PauliStringComplex, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __hash__(self) int¶
Hash over the operator part (x, y); ignores the coefficient.
- __init__(self) None¶
- __init__(self, arg0: pauliengine._core.Expression, arg1: collections.abc.Mapping[int, str], /) None
- __init__(self, arg0: pauliengine._core.Expression, arg1: str, /) None
- __init__(self, arg: tuple[pauliengine._core.Expression, collections.abc.Sequence[tuple[str, int]]], /) None
Overloaded function.
__init__(self) -> None
The zero Pauli string (identity operator, coefficient 0).
__init__(self, arg0: pauliengine._core.Expression, arg1: collections.abc.Mapping[int, str], /) -> None
From a symbolic coefficient (Expression) and a map {qubit: ‘X’/’Y’/’Z’/’I’}.
__init__(self, arg0: pauliengine._core.Expression, arg1: str, /) -> None
From a symbolic coefficient (Expression) and a text: dense such as ‘XIZ’ (character i acts on qubit i) or sparse such as ‘X0 Z2’.
__init__(self, arg: tuple[pauliengine._core.Expression, collections.abc.Sequence[tuple[str, int]]], /) -> None
From an OpenFermion-style pair (Expression, [(‘X’, qubit), …]).
- __len__(self) int¶
Number of qubits with a non-identity operator (the weight).
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSymbolic¶
- __mul__(self, arg: float, /) pauliengine._core.PauliStringSymbolic
- __mul__(self, arg: int, /) pauliengine._core.PauliStringSymbolic
- __mul__(self, arg: complex, /) pauliengine._core.PauliStringSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSymbolic
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliStringSymbolic
Overloaded function.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSymbolic
Product of two Pauli strings, including the phase of the Pauli algebra.
__mul__(self, arg: float, /) -> pauliengine._core.PauliStringSymbolic
The Pauli string scaled by a float.
__mul__(self, arg: int, /) -> pauliengine._core.PauliStringSymbolic
The Pauli string scaled by a int.
__mul__(self, arg: complex, /) -> pauliengine._core.PauliStringSymbolic
The Pauli string scaled by a complex number.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSymbolic
Product with a complex Pauli string; the result is symbolic.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliStringSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic¶
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Subtract two PauliStringSymbolic to get PauliStringSumSymbolic
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Subtract PauliStringSymbolic and PauliStringComplex to get PauliStringSumSymbolic
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- anticommutes(self, other: pauliengine._core.PauliStringSymbolic) bool¶
True if the strings anti-commute.
- commutator(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSymbolic¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSymbolic
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
commutator(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSymbolic
Commutator [self, other] = self*other - other*self (a single Pauli string, zero if they commute).
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- copy(self) pauliengine._core.PauliStringSymbolic¶
An independent copy of the Pauli string.
- count_y(self) int¶
Number of Y operators in the Pauli string.
- diff(self, arg: str, /) pauliengine._core.PauliStringSymbolic¶
Derivative of the coefficient with respect to the named symbol.
- equals(self, arg: pauliengine._core.PauliStringSymbolic, /) bool¶
True if the operators are equal, ignoring the coefficients.
- get_coeff(self) pauliengine._core.Expression¶
The coefficient of the Pauli string.
- get_hash(self) int¶
Invertible int key of the operator part (coefficient ignored): sum_q p_q * 4**q with I=0, X=1, Y=2, Z=3.
- get_pauli_at_index(self, arg: int, /) str¶
Pauli operator (‘I’, ‘X’, ‘Y’ or ‘Z’) on the given qubit.
- inner_product(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.Expression¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.Expression
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_all_z(self) int¶
True if every non-identity operator is Z.
- key_openfermion(self) list[tuple[str, int]]¶
OpenFermion-style key: list of (Pauli, qubit) pairs of the non-identity sites, sorted by qubit.
- map_qubits(self, arg: collections.abc.Mapping[int, int], /) pauliengine._core.PauliStringSymbolic¶
Copy with qubit indices remapped by {old: new}; an occupied target that is not itself remapped is swapped.
- naked(self) pauliengine._core.PauliStringSymbolic¶
Copy of the Pauli string with coefficient 1.
- qubits(self) list[int]¶
Sorted list of the qubits with a non-identity operator.
- set_coeff(self, arg: pauliengine._core.Expression, /) None¶
Replace the coefficient (in place) by an Expression.
- size(self) int¶
Number of qubits with a non-identity operator (the weight).
- subs(self, values: collections.abc.Mapping[str, complex | str | pauliengine._core.Expression]) pauliengine._core.PauliStringSymbolic¶
Substitute values for symbols, given as {name: value}. A value is a number, an Expression or a polynomial as text such as ‘b + 2*c’; all symbols are replaced at once, so {‘a’: ‘b’, ‘b’: ‘a’} swaps them. Symbols without a value stay.
- targeted_commutator(self, other: pauliengine._core.PauliStringSymbolic, target: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression¶
Coefficient of target’s operator in [self, other] (0 if absent); target’s coefficient is ignored.
- to_dictionary(self) tuple[pauliengine._core.Expression, dict[int, str]]¶
The Pauli string as a (coefficient, {qubit: ‘X’/’Y’/’Z’}) pair.
- to_string(self) str¶
Human-readable form, e.g. ‘1.000000 + 0.000000i : X(0)Z(2)’.
- trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], /) pauliengine._core.PauliStringSymbolic¶
- trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[tuple[complex, complex]], /) pauliengine._core.PauliStringSymbolic
Overloaded function.
trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], /) -> pauliengine._core.PauliStringSymbolic
Project onto a computational-basis state of the listed qubits (state[i] in {0, 1}).
trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[tuple[complex, complex]], /) -> pauliengine._core.PauliStringSymbolic
Project onto general single-qubit states (a, b) representing a|0>+b|1> per traced qubit.
- property coeff¶
The coefficient of the Pauli string (read-only).
- from_hash = <nanobind.nb_func object>¶
- property is_zero¶
True if the coefficient is (symbolically) zero.
- to_complex = <nanobind.nb_func object>¶
- property x¶
x bits as 64-bit words (bit q set for X or Z on qubit q).
- property y¶
y bits as 64-bit words (bit q set for Y or Z on qubit q).
- class pauliengine._core.unweighted_pauliString(*args, **kwargs)¶
Bases:
objectA Pauli string without a coefficient: i**phase * P with phase in {0, 1, 2, 3}. Use it only as a basis element of a Lie algebra; for linear combinations use weighted strings. The product of two such strings has an exact phase; use to_pauli_string() to attach a coefficient.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.unweighted_PauliStringSum
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.unweighted_PauliStringSum
The string followed by the new elements of the set.
- __eq__(self, arg: pauliengine._core.unweighted_pauliString, /) bool¶
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.unweighted_pauliString, /) -> bool
True if both the operator and the phase are equal (see equals() for the operator only).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __hash__(self) int¶
Hash over the operator part; ignores the phase.
- __init__(self) None¶
- __init__(self, paulis: str, phase: int = 0) None
- __init__(self, paulis: collections.abc.Mapping[int, str], phase: int = 0) None
- __init__(self, paulis: collections.abc.Sequence[tuple[str, int]], phase: int = 0) None
- __init__(self, string: pauliengine._core.PauliStringComplex, phase: int = 0) None
- __init__(self, string: pauliengine._core.PauliStringSymbolic, phase: int = 0) None
- __init__(self, string: pauliengine._core.SparsePauliStringComplex, phase: int = 0) None
- __init__(self, string: pauliengine._core.SparsePauliStringSymbolic, phase: int = 0) None
Overloaded function.
__init__(self) -> None
The identity with phase 0.
__init__(self, paulis: str, phase: int = 0) -> None
From a text, dense such as ‘XIZ’ or sparse such as ‘X0 Z2’; phase is the exponent k of i**k.
__init__(self, paulis: collections.abc.Mapping[int, str], phase: int = 0) -> None
From a map {qubit: ‘X’/’Y’/’Z’/’I’}; phase is the exponent k of i**k.
__init__(self, paulis: collections.abc.Sequence[tuple[str, int]], phase: int = 0) -> None
From a list of (Pauli, qubit) pairs; phase is the exponent k of i**k.
__init__(self, string: pauliengine._core.PauliStringComplex, phase: int = 0) -> None
The operator part of a Pauli string; its coefficient is dropped.
__init__(self, string: pauliengine._core.PauliStringSymbolic, phase: int = 0) -> None
The operator part of a symbolic Pauli string; its coefficient is dropped.
__init__(self, string: pauliengine._core.SparsePauliStringComplex, phase: int = 0) -> None
The operator part of a sparse Pauli string; its coefficient is dropped.
__init__(self, string: pauliengine._core.SparsePauliStringSymbolic, phase: int = 0) -> None
The operator part of a symbolic sparse Pauli string; its coefficient is dropped.
- __len__(self) int¶
Number of qubits with a non-identity operator (the weight).
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.unweighted_pauliString¶
- __mul__(self, arg: complex, /) pauliengine._core.PauliStringComplex
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringComplex
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.unweighted_PauliStringSum
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliStringSymbolic
Overloaded function.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.unweighted_pauliString
Product of two strings, including the phase of the Pauli algebra.
__mul__(self, arg: complex, /) -> pauliengine._core.PauliStringComplex
The weighted Pauli string with coefficient scale * i**phase.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.unweighted_PauliStringSum
The set of all products string * element.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliStringSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
Difference with a weighted operator; this counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.unweighted_pauliString | None¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringComplex
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.unweighted_PauliStringSum
Overloaded function.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.unweighted_pauliString | None
The commutator without its factor 2: self * other if the strings anti-commute, otherwise None.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.unweighted_PauliStringSum
The set of commutators without their factor 2 with every element.
- commutes(self, other: pauliengine._core.unweighted_pauliString) bool¶
True if the two strings commute, false if they anti-commute.
- count_y(self) int¶
Number of Y operators in the string.
- dagger(self) pauliengine._core.unweighted_pauliString¶
Hermitian conjugate: the operator stays and the phase is conjugated.
- equals(self, other: pauliengine._core.unweighted_pauliString) bool¶
True if the operators are equal, ignoring the phases.
- get_hash(self) int¶
Invertible int key of the operator part (phase ignored): sum_q p_q * 4**q with I=0, X=1, Y=2, Z=3.
- get_pauli_at_index(self, index: int) str¶
Pauli operator (‘I’, ‘X’, ‘Y’ or ‘Z’) on the given qubit.
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product; both count with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product; both count with coefficient 1.0 * i**phase.
- key_openfermion(self) list[tuple[str, int]]¶
OpenFermion-style key: list of (Pauli, qubit) pairs of the non-identity sites, sorted by qubit.
- naked(self) pauliengine._core.unweighted_pauliString¶
Copy of the string with phase 0.
- qubits(self) list[int]¶
Sorted list of the qubits with a non-identity operator.
- size(self) int¶
Number of qubits with a non-identity operator (the weight).
- to_dictionary(self) tuple[complex, dict[int, str]]¶
The string as a (phase factor, {qubit: ‘X’/’Y’/’Z’}) pair.
- to_pauli_string(self, coeff: complex = 1 + 0j) pauliengine._core.PauliStringComplex¶
- to_pauli_string(self, coeff: str) pauliengine._core.PauliStringSymbolic
- to_pauli_string(self, coeff: pauliengine._core.Expression) pauliengine._core.PauliStringSymbolic
Overloaded function.
to_pauli_string(self, coeff: complex = (1+0j)) -> pauliengine._core.PauliStringComplex
The Pauli string with coefficient coeff * i**phase.
to_pauli_string(self, coeff: str) -> pauliengine._core.PauliStringSymbolic
The symbolic Pauli string with coefficient coeff * i**phase; coeff is parsed like ‘a*b’.
to_pauli_string(self, coeff: pauliengine._core.Expression) -> pauliengine._core.PauliStringSymbolic
The symbolic Pauli string with coefficient coeff * i**phase.
- to_string(self) str¶
Human-readable form, e.g. ‘+i : X(0)Z(2)’.
- from_hash = <nanobind.nb_func object>¶
- property phase¶
Exponent k of the phase i**k, in {0, 1, 2, 3}.
- property phase_factor¶
The phase i**k as a complex number.
- property x¶
x bits as 64-bit words (bit q set for X or Z on qubit q).
- property y¶
y bits as 64-bit words (bit q set for Y or Z on qubit q).
- class pauliengine._core.SparsePauliStringComplex(*args, **kwargs)¶
Bases:
objectA Pauli string with a complex coefficient, stored as the sorted list of its non-identity sites. Costs grow with the weight instead of the highest qubit; meant for low-weight strings on many qubits.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) object¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliOrbit, /) object
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __eq__(self, arg: pauliengine._core.SparsePauliStringComplex, /) bool¶
- __eq__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) bool
- __eq__(self, arg: pauliengine._core.PauliStringComplex, /) bool
- __eq__(self, arg: pauliengine._core.PauliStringSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.PauliStringComplex, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __hash__(self) int¶
Hash over the operator part, the same as for the Pauli string with bit vectors.
- __init__(self, coeff: complex, data: collections.abc.Mapping[int, str]) None¶
- __init__(self, coeff: complex, pauli_string: str) None
- __init__(self, pauli_string: pauliengine._core.PauliStringComplex) None
Overloaded function.
__init__(self, coeff: complex, data: collections.abc.Mapping[int, str]) -> None
From a coefficient and a map {qubit: ‘X’/’Y’/’Z’/’I’}.
__init__(self, coeff: complex, pauli_string: str) -> None
From a coefficient and a text: dense such as ‘XIZ’ or sparse such as ‘X0 Z2’.
__init__(self, pauli_string: pauliengine._core.PauliStringComplex) -> None
The same string as a Pauli string with bit vectors.
- __len__(self) int¶
Number of qubits with a non-identity operator (the weight).
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object¶
- __mul__(self, scale: int) pauliengine._core.SparsePauliStringComplex
- __mul__(self, scale: float) pauliengine._core.SparsePauliStringComplex
- __mul__(self, scale: complex) pauliengine._core.SparsePauliStringComplex
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.SparsePauliStringSymbolic
Overloaded function.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with the phase of the Pauli algebra; with bit vectors if it no longer fits the sparse representation.
__mul__(self, scale: int) -> pauliengine._core.SparsePauliStringComplex
The string with its coefficient scaled by an int, float or complex number.
__mul__(self, scale: float) -> pauliengine._core.SparsePauliStringComplex
The string with its coefficient scaled by an int, float or complex number.
__mul__(self, scale: complex) -> pauliengine._core.SparsePauliStringComplex
The string with its coefficient scaled by an int, float or complex number.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.SparsePauliStringSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) object¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- anticommutes(self, other: pauliengine._core.SparsePauliStringComplex) bool¶
True if the strings anti-commute.
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object¶
- commutator(self, other: pauliengine._core.PauliStringComplex) object
- commutator(self, other: pauliengine._core.PauliStringSymbolic) object
- commutator(self, other: pauliengine._core.PauliStringSumComplex) object
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.PauliCycleComplex) object
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) object
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) object
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) object
- commutator(self, other: pauliengine._core.PauliOrbit) object
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) object
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) object
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) object
Overloaded function.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other]: 2 * self * other if they anti-commute, else the zero string; with bit vectors if it no longer fits the sparse representation.
commutator(self, other: pauliengine._core.PauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> object
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> object
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- copy(self) pauliengine._core.SparsePauliStringComplex¶
An independent copy.
- count_y(self) int¶
Number of Y operators.
- equals(self, arg: pauliengine._core.SparsePauliStringComplex, /) bool¶
True if the operators are equal, ignoring the coefficients.
- fits_sparse(self) bool¶
Whether the string still fits the sparse representation; results of arithmetic that do not are returned with bit vectors.
- get_coeff(self) complex¶
The coefficient.
- get_hash(self) int¶
Invertible int key of the operator part (as PauliString.get_hash()).
- get_pauli_at_index(self, arg: int, /) str¶
Pauli operator (‘I’, ‘X’, ‘Y’ or ‘Z’) on the given qubit.
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_all_z(self) bool¶
True if every non-identity operator is Z.
- key_openfermion(self) list[tuple[str, int]]¶
OpenFermion-style key: list of (Pauli, qubit) pairs, sorted by qubit.
- map_qubits(self, arg: collections.abc.Mapping[int, int], /) pauliengine._core.SparsePauliStringComplex¶
Copy with qubit indices remapped by {old: new}.
- naked(self) pauliengine._core.SparsePauliStringComplex¶
Copy with coefficient 1.
- qubits(self) list[int]¶
Sorted list of the qubits with a non-identity operator.
- set_coeff(self, arg: complex, /) None¶
Replace the coefficient (in place).
- size(self) int¶
Number of qubits with a non-identity operator (the weight).
- targeted_commutator(self, other: pauliengine._core.SparsePauliStringComplex, target: pauliengine._core.SparsePauliStringComplex) complex¶
Coefficient of target’s operator in [self, other].
- to_dense(self) pauliengine._core.PauliStringComplex¶
The string as a Pauli string with bit vectors.
- to_dictionary(self) tuple[complex, dict[int, str]]¶
The string as a (coefficient, {qubit: ‘X’/’Y’/’Z’}) pair.
- to_string(self) str¶
Human-readable form, e.g. ‘1.000000 + 0.000000i : X(0)Z(2)’.
- trace_out_qubits(self, qubits: collections.abc.Sequence[int], state: collections.abc.Sequence[int]) pauliengine._core.SparsePauliStringComplex¶
- trace_out_qubits(self, qubits: collections.abc.Sequence[int], states: collections.abc.Sequence[tuple[complex, complex]]) pauliengine._core.SparsePauliStringComplex
Overloaded function.
trace_out_qubits(self, qubits: collections.abc.Sequence[int], state: collections.abc.Sequence[int]) -> pauliengine._core.SparsePauliStringComplex
Trace out the given qubits in computational basis states.
trace_out_qubits(self, qubits: collections.abc.Sequence[int], states: collections.abc.Sequence[tuple[complex, complex]]) -> pauliengine._core.SparsePauliStringComplex
Trace out the given qubits in states a|0> + b|1>.
- property coeff¶
The coefficient (read-only).
- from_hash = <nanobind.nb_func object>¶
- property is_zero¶
True if the coefficient is zero.
- property sites¶
The non-identity sites as (qubit, Pauli) pairs by ascending qubit.
- property x¶
x bits as 64-bit words (as PauliString.x; formed from the sites).
- property y¶
y bits as 64-bit words (as PauliString.y; formed from the sites).
- class pauliengine._core.SparsePauliStringSymbolic(*args, **kwargs)¶
Bases:
objectA Pauli string with a symbolic coefficient, stored as the sorted list of its non-identity sites.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) object¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliOrbit, /) object
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __eq__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) bool¶
- __eq__(self, arg: pauliengine._core.SparsePauliStringComplex, /) bool
- __eq__(self, arg: pauliengine._core.PauliStringComplex, /) bool
- __eq__(self, arg: pauliengine._core.PauliStringSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.PauliStringComplex, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> bool
True if both the operator and the coefficient are equal (see equals() for the operator only).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __hash__(self) int¶
Hash over the operator part, the same as for the Pauli string with bit vectors.
- __init__(self, coeff: pauliengine._core.Expression, data: collections.abc.Mapping[int, str]) None¶
- __init__(self, coeff: pauliengine._core.Expression, pauli_string: str) None
- __init__(self, pauli_string: pauliengine._core.PauliStringSymbolic) None
Overloaded function.
__init__(self, coeff: pauliengine._core.Expression, data: collections.abc.Mapping[int, str]) -> None
From a coefficient and a map {qubit: ‘X’/’Y’/’Z’/’I’}.
__init__(self, coeff: pauliengine._core.Expression, pauli_string: str) -> None
From a coefficient and a text: dense such as ‘XIZ’ or sparse such as ‘X0 Z2’.
__init__(self, pauli_string: pauliengine._core.PauliStringSymbolic) -> None
The same string as a Pauli string with bit vectors.
- __len__(self) int¶
Number of qubits with a non-identity operator (the weight).
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object¶
- __mul__(self, scale: int) pauliengine._core.SparsePauliStringSymbolic
- __mul__(self, scale: float) pauliengine._core.SparsePauliStringSymbolic
- __mul__(self, scale: complex) pauliengine._core.SparsePauliStringSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.SparsePauliStringSymbolic
Overloaded function.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with the phase of the Pauli algebra; with bit vectors if it no longer fits the sparse representation.
__mul__(self, scale: int) -> pauliengine._core.SparsePauliStringSymbolic
The string with its coefficient scaled by an int, float or complex number.
__mul__(self, scale: float) -> pauliengine._core.SparsePauliStringSymbolic
The string with its coefficient scaled by an int, float or complex number.
__mul__(self, scale: complex) -> pauliengine._core.SparsePauliStringSymbolic
The string with its coefficient scaled by an int, float or complex number.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.SparsePauliStringSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) object¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- anticommutes(self, other: pauliengine._core.SparsePauliStringSymbolic) bool¶
True if the strings anti-commute.
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object¶
- commutator(self, other: pauliengine._core.PauliStringComplex) object
- commutator(self, other: pauliengine._core.PauliStringSymbolic) object
- commutator(self, other: pauliengine._core.PauliStringSumComplex) object
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.PauliCycleComplex) object
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) object
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) object
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) object
- commutator(self, other: pauliengine._core.PauliOrbit) object
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) object
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) object
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) object
Overloaded function.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other]: 2 * self * other if they anti-commute, else the zero string; with bit vectors if it no longer fits the sparse representation.
commutator(self, other: pauliengine._core.PauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> object
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> object
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- copy(self) pauliengine._core.SparsePauliStringSymbolic¶
An independent copy.
- count_y(self) int¶
Number of Y operators.
- diff(self, symbol: str) pauliengine._core.SparsePauliStringSymbolic¶
Derivative of the coefficient with respect to the named symbol.
- equals(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) bool¶
True if the operators are equal, ignoring the coefficients.
- fits_sparse(self) bool¶
Whether the string still fits the sparse representation; results of arithmetic that do not are returned with bit vectors.
- get_coeff(self) pauliengine._core.Expression¶
The coefficient.
- get_hash(self) int¶
Invertible int key of the operator part (as PauliString.get_hash()).
- get_pauli_at_index(self, arg: int, /) str¶
Pauli operator (‘I’, ‘X’, ‘Y’ or ‘Z’) on the given qubit.
- inner_product(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.Expression¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.Expression
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_all_z(self) bool¶
True if every non-identity operator is Z.
- key_openfermion(self) list[tuple[str, int]]¶
OpenFermion-style key: list of (Pauli, qubit) pairs, sorted by qubit.
- map_qubits(self, arg: collections.abc.Mapping[int, int], /) pauliengine._core.SparsePauliStringSymbolic¶
Copy with qubit indices remapped by {old: new}.
- naked(self) pauliengine._core.SparsePauliStringSymbolic¶
Copy with coefficient 1.
- qubits(self) list[int]¶
Sorted list of the qubits with a non-identity operator.
- set_coeff(self, arg: pauliengine._core.Expression, /) None¶
Replace the coefficient (in place).
- size(self) int¶
Number of qubits with a non-identity operator (the weight).
- subs(self, values: collections.abc.Mapping[str, complex | str | pauliengine._core.Expression]) pauliengine._core.SparsePauliStringSymbolic¶
Substitute values for symbols, given as {name: value}. A value is a number, an Expression or a polynomial as text such as ‘b + 2*c’; all symbols are replaced at once, so {‘a’: ‘b’, ‘b’: ‘a’} swaps them. Symbols without a value stay.
- targeted_commutator(self, other: pauliengine._core.SparsePauliStringSymbolic, target: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression¶
Coefficient of target’s operator in [self, other].
- to_dense(self) pauliengine._core.PauliStringSymbolic¶
The string as a Pauli string with bit vectors.
- to_dictionary(self) tuple[pauliengine._core.Expression, dict[int, str]]¶
The string as a (coefficient, {qubit: ‘X’/’Y’/’Z’}) pair.
- to_string(self) str¶
Human-readable form, e.g. ‘1.000000 + 0.000000i : X(0)Z(2)’.
- trace_out_qubits(self, qubits: collections.abc.Sequence[int], state: collections.abc.Sequence[int]) pauliengine._core.SparsePauliStringSymbolic¶
- trace_out_qubits(self, qubits: collections.abc.Sequence[int], states: collections.abc.Sequence[tuple[complex, complex]]) pauliengine._core.SparsePauliStringSymbolic
Overloaded function.
trace_out_qubits(self, qubits: collections.abc.Sequence[int], state: collections.abc.Sequence[int]) -> pauliengine._core.SparsePauliStringSymbolic
Trace out the given qubits in computational basis states.
trace_out_qubits(self, qubits: collections.abc.Sequence[int], states: collections.abc.Sequence[tuple[complex, complex]]) -> pauliengine._core.SparsePauliStringSymbolic
Trace out the given qubits in states a|0> + b|1>.
- property coeff¶
The coefficient (read-only).
- from_hash = <nanobind.nb_func object>¶
- property is_zero¶
True if the coefficient is zero.
- property sites¶
The non-identity sites as (qubit, Pauli) pairs by ascending qubit.
- to_complex = <nanobind.nb_func object>¶
- property x¶
x bits as 64-bit words (as PauliString.x; formed from the sites).
- property y¶
y bits as 64-bit words (as PauliString.y; formed from the sites).
Pauli string sums (qubit Hamiltonians)¶
PauliStringSum was called QubitHamiltonian before; the old names
(QubitHamiltonian, QubitHamiltonianComplex, QubitHamiltonianSymbolic,
unweighted_QubitHamiltonian, to_qubit_hamiltonian(), the module
pauliengine.qubit_hamiltonian) remain as aliases.
- class pauliengine.pauli_string_sum.PauliStringSumFactory(name, builders)[source]¶
Bases:
objectFactory behind
pauliengine.PauliStringSum.Builds a
PauliStringSumComplexor, as soon as any term is symbolic, aPauliStringSumSymbolic. When the strings are light on average on many qubits it gives aSparsePauliStringSumComplexorSparsePauliStringSumSymbolicinstead (seeset_sparse_threshold), whatever the form of the input; an existing sum or an OpenFermion operator is decided by the same rule. Accepted inputs:list[PauliString](complex, symbolic or mixed)list[tuple[coeff, dict[int, str]]](coeff a number or a symbolic string)openfermion.QubitOperatoran existing
PauliStringSumComplex/PauliStringSumSymbolic(copied)
A list of Pauli strings without a coefficient gives an
unweighted_PauliStringSum: an ordered set of operators with one phase each, meant as the basis of a Lie algebra. It is not a linear combination, soA + A == A, and itscommutatoromits the factor 2. Next to terms with a coefficient, a string without one becomes a term of the Hamiltonian’s type with the coefficienti**phase.isinstance(x, PauliStringSum)is true for every weighted sum, complex or symbolic, with bit vectors or sparse; anunweighted_PauliStringSumis a set, not a sum, and is not one.- Parameters:
name (str)
builders (dict[type, type])
- static from_matrix(matrix, threshold=0.0)[source]¶
Decompose a 2**n x 2**n matrix into Pauli strings.
Uses the method of Georges et al. (2025), O(4**n n). Qubit 0 is the most significant bit of the row and column index, matching
to_matrix(ignore_unused_qubits=False), soPauliStringSum.from_matrix(H.to_matrix(False)) == H.- Parameters:
matrix (Any) – A square matrix with side 2**n, as a numpy array or a list of rows. It is not modified.
threshold (float) – Terms with
abs(coefficient) <= thresholdare dropped. The default 0 drops only exact zeros.
- Returns:
The matrix as a
PauliStringSumComplex.- Raises:
ValueError – If the matrix is not square with a power-of-two side.
- Return type:
- static from_openfermion(qop)[source]¶
Build a
PauliStringSumComplexfrom anopenfermion.QubitOperator.- Parameters:
qop (Any)
- Return type:
- static to_openfermion(qh)[source]¶
Convert a Hamiltonian into an
openfermion.QubitOperator.Symbolic coefficients must be fully numeric. Requires
openfermion.
- static unit()[source]¶
The identity Hamiltonian (one term, coefficient 1, no operators).
- Return type:
- pauliengine.from_openfermion(qop)[source]¶
Build a PauliEngine PauliStringSumComplex from an openfermion.QubitOperator.
- Raises:
TypeError – If
qopis not aQubitOperator.- Parameters:
qop (Any)
- Return type:
- class pauliengine._core.PauliStringSumComplex(*args, **kwargs)¶
Bases:
objectA sum of Pauli strings (a qubit Hamiltonian) with complex coefficients. Kept compacted: no two terms share an operator and zero terms are dropped.
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex¶
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Adds two Hamiltonians.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __contains__(self, pauli_string: pauliengine._core.PauliStringComplex) bool¶
- __contains__(self, pauli_string: pauliengine._core.unweighted_pauliString) bool
Overloaded function.
__contains__(self, pauli_string: pauliengine._core.PauliStringComplex) -> bool
True if a term with this Pauli operator is present (coefficient ignored).
__contains__(self, pauli_string: pauliengine._core.unweighted_pauliString) -> bool
True if the Hamiltonian has a non-zero term with this operator.
- __eq__(self, arg: pauliengine._core.PauliStringSumComplex, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) bool
- __eq__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) bool
- __eq__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self, arg: collections.abc.Sequence[pauliengine._core.PauliStringComplex], /) None¶
- __init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringComplex | pauliengine._core.SparsePauliStringComplex]) None
- __init__(self, arg: collections.abc.Sequence[tuple[complex, collections.abc.Mapping[int, str]]], /) None
Overloaded function.
__init__(self, arg: collections.abc.Sequence[pauliengine._core.PauliStringComplex], /) -> None
From a list of Pauli strings (equal operators are merged).
__init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringComplex | pauliengine._core.SparsePauliStringComplex]) -> None
From a list of Pauli strings, sparse ones or mixed (equal operators are merged).
__init__(self, arg: collections.abc.Sequence[tuple[complex, collections.abc.Mapping[int, str]]], /) -> None
From a list of (coefficient, {qubit: ‘X’/’Y’/’Z’}) pairs.
- __len__(self) int¶
Number of Pauli string terms.
- __mul__(self, arg: complex, /) pauliengine._core.PauliStringSumComplex¶
- __mul__(self, arg: float, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: int, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__mul__(self, arg: complex, /) -> pauliengine._core.PauliStringSumComplex
Scales the Hamiltonian by a complex scalar.
__mul__(self, arg: float, /) -> pauliengine._core.PauliStringSumComplex
Scales the Hamiltonian by a float.
__mul__(self, arg: int, /) -> pauliengine._core.PauliStringSumComplex
Scales the Hamiltonian by an int.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Multiplies two Hamiltonians.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliStringSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex¶
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Subtracts two Hamiltonians.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumComplex
Overloaded function.
commutator(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] = self*other - other*self.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- compact(self) pauliengine._core.PauliStringSumComplex¶
Merge terms with equal operators and drop zero terms, in place; returns the result. Every operation already does this.
- conjugate(self) pauliengine._core.PauliStringSumComplex¶
Complex conjugate: conjugates each coefficient and flips its sign for an odd number of Y.
- contains(self, pauli_string: pauliengine._core.PauliStringComplex) complex¶
- contains(self, pauli_string: pauliengine._core.PauliStringSymbolic) complex
- contains(self, pauli_string: collections.abc.Mapping[int, str]) complex
- contains(self, pauli_string: collections.abc.Sequence[tuple[str, int]]) complex
- contains(self, pauli_string: str) complex
- contains(self, pauli_string: pauliengine._core.unweighted_pauliString) complex
Overloaded function.
contains(self, pauli_string: pauliengine._core.PauliStringComplex) -> complex
Coefficient of the given Pauli string in the Hamiltonian (0 if absent); its own coefficient is ignored.
contains(self, pauli_string: pauliengine._core.PauliStringSymbolic) -> complex
Coefficient of the given Pauli string in the Hamiltonian (0 if absent); its own coefficient is ignored.
contains(self, pauli_string: collections.abc.Mapping[int, str]) -> complex
Coefficient of the Pauli string {qubit: ‘X’} in the Hamiltonian (0 if absent).
contains(self, pauli_string: collections.abc.Sequence[tuple[str, int]]) -> complex
Coefficient of the Pauli string [(‘X’, 0), …] in the Hamiltonian (0 if absent).
contains(self, pauli_string: str) -> complex
Coefficient of the Pauli string ‘XIZ’ or ‘X0 Z2’ in the Hamiltonian (0 if absent).
contains(self, pauli_string: pauliengine._core.unweighted_pauliString) -> complex
Coefficient of the given Pauli string in the Hamiltonian (0 if absent); its phase is ignored.
- count_measurements(self) int¶
1 if is_all_z(), else the number of terms.
- dagger(self) pauliengine._core.PauliStringSumComplex¶
Hermitian conjugate: complex-conjugates each coefficient (Pauli strings are Hermitian).
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_all_z(self) bool¶
True if all terms are products of Z operators only.
- is_antihermitian(self) bool¶
True if every coefficient is purely imaginary (abs(real) <= 1e-12).
- is_hermitian(self) bool¶
True if every coefficient is real (abs(imag) <= 1e-12).
- map_qubits(self, arg: collections.abc.Mapping[int, int], /) pauliengine._core.PauliStringSumComplex¶
Copy with qubit indices remapped by {old: new} (see PauliString.map_qubits).
- n_qubits(self) int¶
Number of qubits the Hamiltonian acts on non-trivially.
- paulistrings(self) list[pauliengine._core.PauliStringComplex]¶
Return the list of Pauli string terms.
- power(self, arg: int, /) pauliengine._core.PauliStringSumComplex¶
Raise Hamiltonian to integer power.
- qubits(self) list[int]¶
Sorted list of qubit indices the Hamiltonian acts on non-trivially.
- set_all_coeff(self, value: complex) pauliengine._core.PauliStringSumComplex¶
Return a copy with every term’s coefficient replaced by value.
- simplify(self, threshold: float = 0.0) pauliengine._core.PauliStringSumComplex¶
Copy without the terms whose abs(coefficient) <= threshold.
- size(self) int¶
Number of Pauli string terms.
- split(self) tuple[pauliengine._core.PauliStringSumComplex, pauliengine._core.PauliStringSumComplex]¶
Split into (hermitian, anti-hermitian) parts; needs numeric coefficients.
- square(self) pauliengine._core.PauliStringSumComplex¶
self * self, visiting each commuting pair once.
- targeted_commutator(self, other: pauliengine._core.PauliStringSumComplex, target: pauliengine._core.PauliStringComplex) complex¶
- targeted_commutator(self, other: pauliengine._core.PauliStringComplex, target: pauliengine._core.PauliStringComplex) complex
Overloaded function.
targeted_commutator(self, other: pauliengine._core.PauliStringSumComplex, target: pauliengine._core.PauliStringComplex) -> complex
Coefficient of the target Pauli string in the commutator, via a hash-join, O(min(len(A), len(B))).
targeted_commutator(self, other: pauliengine._core.PauliStringComplex, target: pauliengine._core.PauliStringComplex) -> complex
Coefficient of the target Pauli string in [self, other] for a single Pauli string other.
- to_dictionary(self) list[tuple[complex, dict[int, str]]]¶
Return list of (coefficient, {qubit: Pauli}) pairs.
- to_list(self) list[pauliengine._core.PauliStringComplex]¶
The list of Pauli string terms (same as paulistrings()).
- to_matrix(self, ignore_unused_qubits: bool = True) list[list[complex]]¶
Dense 2**N x 2**N matrix (list of rows). With ignore_unused_qubits, N counts only the qubits the Hamiltonian acts on; otherwise qubit indices are absolute. Needs numeric coefficients.
- to_string(self) str¶
Human-readable form, one term per line.
- trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], /) pauliengine._core.PauliStringSumComplex¶
- trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[tuple[complex, complex]], /) pauliengine._core.PauliStringSumComplex
Overloaded function.
trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], /) -> pauliengine._core.PauliStringSumComplex
Trace out qubits projected onto computational-basis states (state[i] in {0, 1}).
trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[tuple[complex, complex]], /) -> pauliengine._core.PauliStringSumComplex
Trace out qubits projected onto arbitrary single-qubit states (a, b) per traced qubit.
- transpose(self) pauliengine._core.PauliStringSumComplex¶
Transpose: flips the sign of terms with an odd number of Y.
- from_matrix = <nanobind.nb_func object>¶
- unit = <nanobind.nb_func object>¶
- zero = <nanobind.nb_func object>¶
- class pauliengine._core.PauliStringSumSymbolic(*args, **kwargs)¶
Bases:
objectA sum of Pauli strings (a qubit Hamiltonian) with symbolic (polynomial) coefficients. Kept compacted: no two terms share an operator and zero terms are dropped.
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic¶
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Adds two Hamiltonians.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __contains__(self, pauli_string: pauliengine._core.PauliStringSymbolic) bool¶
- __contains__(self, pauli_string: pauliengine._core.unweighted_pauliString) bool
Overloaded function.
__contains__(self, pauli_string: pauliengine._core.PauliStringSymbolic) -> bool
True if a term with this Pauli operator is present (coefficient ignored).
__contains__(self, pauli_string: pauliengine._core.unweighted_pauliString) -> bool
True if the Hamiltonian has a non-zero term with this operator.
- __eq__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliStringSumComplex, /) bool
- __eq__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) bool
- __eq__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self, arg: collections.abc.Sequence[pauliengine._core.PauliStringSymbolic], /) None¶
- __init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringSymbolic | pauliengine._core.SparsePauliStringSymbolic]) None
- __init__(self, arg: collections.abc.Sequence[tuple[pauliengine._core.Expression, collections.abc.Mapping[int, str]]], /) None
Overloaded function.
__init__(self, arg: collections.abc.Sequence[pauliengine._core.PauliStringSymbolic], /) -> None
From a list of Pauli strings (equal operators are merged).
__init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringSymbolic | pauliengine._core.SparsePauliStringSymbolic]) -> None
From a list of Pauli strings, sparse ones or mixed (equal operators are merged).
__init__(self, arg: collections.abc.Sequence[tuple[pauliengine._core.Expression, collections.abc.Mapping[int, str]]], /) -> None
From a list of (coefficient, {qubit: ‘X’/’Y’/’Z’}) pairs.
- __len__(self) int¶
Number of Pauli string terms.
- __mul__(self, arg: complex, /) pauliengine._core.PauliStringSumSymbolic¶
- __mul__(self, arg: float, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: int, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__mul__(self, arg: complex, /) -> pauliengine._core.PauliStringSumSymbolic
Scales the Hamiltonian by a complex scalar.
__mul__(self, arg: float, /) -> pauliengine._core.PauliStringSumSymbolic
Scales the Hamiltonian by a float.
__mul__(self, arg: int, /) -> pauliengine._core.PauliStringSumSymbolic
Scales the Hamiltonian by an int.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Multiplies two Hamiltonians.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliStringSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic¶
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Subtracts two Hamiltonians.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
commutator(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] = self*other - other*self.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- compact(self) pauliengine._core.PauliStringSumSymbolic¶
Merge terms with equal operators and drop zero terms, in place; returns the result. Every operation already does this.
- conjugate(self) pauliengine._core.PauliStringSumSymbolic¶
Complex conjugate: conjugates each coefficient and flips its sign for an odd number of Y.
- contains(self, pauli_string: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression¶
- contains(self, pauli_string: pauliengine._core.PauliStringComplex) pauliengine._core.Expression
- contains(self, pauli_string: collections.abc.Mapping[int, str]) pauliengine._core.Expression
- contains(self, pauli_string: collections.abc.Sequence[tuple[str, int]]) pauliengine._core.Expression
- contains(self, pauli_string: str) pauliengine._core.Expression
- contains(self, pauli_string: pauliengine._core.unweighted_pauliString) pauliengine._core.Expression
Overloaded function.
contains(self, pauli_string: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Coefficient of the given Pauli string in the Hamiltonian (0 if absent); its own coefficient is ignored.
contains(self, pauli_string: pauliengine._core.PauliStringComplex) -> pauliengine._core.Expression
Coefficient of the given Pauli string in the Hamiltonian (0 if absent); its own coefficient is ignored.
contains(self, pauli_string: collections.abc.Mapping[int, str]) -> pauliengine._core.Expression
Coefficient of the Pauli string {qubit: ‘X’} in the Hamiltonian (0 if absent).
contains(self, pauli_string: collections.abc.Sequence[tuple[str, int]]) -> pauliengine._core.Expression
Coefficient of the Pauli string [(‘X’, 0), …] in the Hamiltonian (0 if absent).
contains(self, pauli_string: str) -> pauliengine._core.Expression
Coefficient of the Pauli string ‘XIZ’ or ‘X0 Z2’ in the Hamiltonian (0 if absent).
contains(self, pauli_string: pauliengine._core.unweighted_pauliString) -> pauliengine._core.Expression
Coefficient of the given Pauli string in the Hamiltonian (0 if absent); its phase is ignored.
- count_measurements(self) int¶
1 if is_all_z(), else the number of terms.
- dagger(self) pauliengine._core.PauliStringSumSymbolic¶
Hermitian conjugate: complex-conjugates each coefficient (Pauli strings are Hermitian).
- diff(self, arg: str, /) pauliengine._core.PauliStringSumSymbolic¶
Derivative of every coefficient with respect to the named symbol.
- inner_product(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.Expression¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.Expression
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_all_z(self) bool¶
True if all terms are products of Z operators only.
- is_antihermitian(self) bool¶
True if every coefficient is purely imaginary (abs(real) <= 1e-12).
- is_hermitian(self) bool¶
True if every coefficient is real (abs(imag) <= 1e-12).
- map_qubits(self, arg: collections.abc.Mapping[int, int], /) pauliengine._core.PauliStringSumSymbolic¶
Copy with qubit indices remapped by {old: new} (see PauliString.map_qubits).
- n_qubits(self) int¶
Number of qubits the Hamiltonian acts on non-trivially.
- paulistrings(self) list[pauliengine._core.PauliStringSymbolic]¶
Return the list of Pauli string terms.
- power(self, arg: int, /) pauliengine._core.PauliStringSumSymbolic¶
Raise Hamiltonian to integer power.
- qubits(self) list[int]¶
Sorted list of qubit indices the Hamiltonian acts on non-trivially.
- set_all_coeff(self, value: complex) pauliengine._core.PauliStringSumSymbolic¶
Return a copy with every term’s coefficient replaced by value.
- simplify(self, threshold: float = 0.0) pauliengine._core.PauliStringSumSymbolic¶
Copy without the terms whose abs(coefficient) <= threshold.
- size(self) int¶
Number of Pauli string terms.
- split(self) tuple[pauliengine._core.PauliStringSumSymbolic, pauliengine._core.PauliStringSumSymbolic]¶
Split into (hermitian, anti-hermitian) parts; needs numeric coefficients.
- square(self) pauliengine._core.PauliStringSumSymbolic¶
self * self, visiting each commuting pair once.
- subs(self, values: collections.abc.Mapping[str, complex | str | pauliengine._core.Expression]) pauliengine._core.PauliStringSumSymbolic¶
Substitute values for symbols, given as {name: value}. A value is a number, an Expression or a polynomial as text such as ‘b + 2*c’; all symbols are replaced at once, so {‘a’: ‘b’, ‘b’: ‘a’} swaps them. Symbols without a value stay.
- targeted_commutator(self, other: pauliengine._core.PauliStringSumSymbolic, target: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression¶
- targeted_commutator(self, other: pauliengine._core.PauliStringSymbolic, target: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
Overloaded function.
targeted_commutator(self, other: pauliengine._core.PauliStringSumSymbolic, target: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Coefficient of the target Pauli string in the commutator, via a hash-join, O(min(len(A), len(B))).
targeted_commutator(self, other: pauliengine._core.PauliStringSymbolic, target: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Coefficient of the target Pauli string in [self, other] for a single Pauli string other.
- to_dictionary(self) list[tuple[pauliengine._core.Expression, dict[int, str]]]¶
Return list of (coefficient, {qubit: Pauli}) pairs.
- to_list(self) list[pauliengine._core.PauliStringSymbolic]¶
The list of Pauli string terms (same as paulistrings()).
- to_matrix(self, ignore_unused_qubits: bool = True) list[list[complex]]¶
Dense 2**N x 2**N matrix (list of rows). With ignore_unused_qubits, N counts only the qubits the Hamiltonian acts on; otherwise qubit indices are absolute. Needs numeric coefficients.
- to_string(self) str¶
Human-readable form, one term per line.
- trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], /) pauliengine._core.PauliStringSumSymbolic¶
- trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[tuple[complex, complex]], /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[int], /) -> pauliengine._core.PauliStringSumSymbolic
Trace out qubits projected onto computational-basis states (state[i] in {0, 1}).
trace_out_qubits(self, arg0: collections.abc.Sequence[int], arg1: collections.abc.Sequence[tuple[complex, complex]], /) -> pauliengine._core.PauliStringSumSymbolic
Trace out qubits projected onto arbitrary single-qubit states (a, b) per traced qubit.
- transpose(self) pauliengine._core.PauliStringSumSymbolic¶
Transpose: flips the sign of terms with an odd number of Y.
- unit = <nanobind.nb_func object>¶
- zero = <nanobind.nb_func object>¶
- class pauliengine._core.unweighted_PauliStringSum(*args, **kwargs)¶
Bases:
objectAn ordered set of Pauli operators with one phase i**k per element. Use it only as the basis of a Lie algebra. It is not a linear combination: every operator occurs once and the first phase seen for it wins, so A + A == A. An element keeps its index.
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.unweighted_PauliStringSum¶
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.unweighted_PauliStringSum
Overloaded function.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.unweighted_PauliStringSum
Union: the elements of self, then the new ones of other.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.unweighted_PauliStringSum
Add the string unless its operator is present, as a new set.
- __contains__(self, term: pauliengine._core.unweighted_pauliString) bool¶
True if the operator of the string is present, whatever the phases are.
- __eq__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) bool¶
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> bool
Equal sets with equal phases, whatever the order of the elements is.
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self) None¶
- __init__(self, terms: collections.abc.Sequence[pauliengine._core.unweighted_pauliString]) None
- __init__(self, hamiltonian: pauliengine._core.PauliStringSumComplex) None
- __init__(self, hamiltonian: pauliengine._core.PauliStringSumSymbolic) None
- __init__(self, hamiltonian: pauliengine._core.SparsePauliStringSumComplex) None
- __init__(self, hamiltonian: pauliengine._core.SparsePauliStringSumSymbolic) None
Overloaded function.
__init__(self) -> None
The empty set.
__init__(self, terms: collections.abc.Sequence[pauliengine._core.unweighted_pauliString]) -> None
From a list of strings; later duplicates of an operator are ignored.
__init__(self, hamiltonian: pauliengine._core.PauliStringSumComplex) -> None
The operators of a Hamiltonian with phase 0; its coefficients are dropped.
__init__(self, hamiltonian: pauliengine._core.PauliStringSumSymbolic) -> None
The operators of a symbolic Hamiltonian with phase 0; its coefficients are dropped.
__init__(self, hamiltonian: pauliengine._core.SparsePauliStringSumComplex) -> None
The operators of a sparse sum with phase 0; its coefficients are dropped.
__init__(self, hamiltonian: pauliengine._core.SparsePauliStringSumSymbolic) -> None
The operators of a symbolic sparse sum with phase 0; its coefficients are dropped.
- __len__(self) int¶
Number of elements.
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.unweighted_PauliStringSum¶
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.unweighted_PauliStringSum
- __mul__(self, arg: complex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.unweighted_PauliStringSum
The set of all products a * b in the order of a, then b.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.unweighted_PauliStringSum
The set of all products element * string.
__mul__(self, arg: complex, /) -> pauliengine._core.PauliStringSumComplex
The weighted Hamiltonian with coefficient scale * i**k on every element.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliStringSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
Difference with a weighted operator; this counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.unweighted_PauliStringSum¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.unweighted_PauliStringSum
Overloaded function.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.unweighted_PauliStringSum
The set of commutators without their factor 2: a * b for every anti-commuting pair.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator with another operator; next to a weighted one this counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.unweighted_PauliStringSum
The set of commutators without their factor 2 with the string.
- index(self, term: pauliengine._core.unweighted_pauliString) int¶
Index of the operator of the string; raises ValueError if it is not present.
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with a weighted operator; this counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product; both count with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product; both count with coefficient 1.0 * i**phase.
- insert(self, term: pauliengine._core.unweighted_pauliString) bool¶
Add the string unless its operator is present; returns whether it was added.
- paulistrings(self) list[pauliengine._core.unweighted_pauliString]¶
All elements in insertion order, as PauliStringSum.paulistrings().
- size(self) int¶
Number of elements.
- terms(self) list[pauliengine._core.unweighted_pauliString]¶
All elements in insertion order.
- to_pauli_string_sum(self, coeff: complex = 1 + 0j) pauliengine._core.PauliStringSumComplex¶
- to_pauli_string_sum(self, coeff: str) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
to_pauli_string_sum(self, coeff: complex = (1+0j)) -> pauliengine._core.PauliStringSumComplex
The ordinary Hamiltonian with coefficient coeff * i**k on every element.
to_pauli_string_sum(self, coeff: str) -> pauliengine._core.PauliStringSumSymbolic
The symbolic Hamiltonian with coefficient coeff * i**k on every element; coeff is parsed like ‘a*b’.
- class pauliengine._core.SparsePauliStringSumComplex(*args, **kwargs)¶
Bases:
objectA sum of sparse Pauli strings with complex coefficients. Products, commutators and squares cost O(w) per pair of terms of weight w instead of O(n / 64) words. Kept compacted.
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object¶
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliOrbit, /) object
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
Overloaded function.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __contains__(self, pauli_string: pauliengine._core.SparsePauliStringComplex) bool¶
- __contains__(self, pauli_string: pauliengine._core.PauliStringComplex) bool
True if the operator has a non-zero term.
- __eq__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) bool¶
- __eq__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) bool
- __eq__(self, arg: pauliengine._core.PauliStringSumComplex, /) bool
- __eq__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self, data: collections.abc.Sequence[pauliengine._core.SparsePauliStringComplex]) None¶
- __init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringComplex]) None
- __init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringComplex | pauliengine._core.SparsePauliStringComplex]) None
- __init__(self, data: collections.abc.Sequence[tuple[complex, collections.abc.Mapping[int, str]]]) None
- __init__(self, hamiltonian: pauliengine._core.PauliStringSumComplex) None
Overloaded function.
__init__(self, data: collections.abc.Sequence[pauliengine._core.SparsePauliStringComplex]) -> None
From a list of sparse Pauli strings (equal operators are merged).
__init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringComplex]) -> None
From a list of Pauli strings with bit vectors.
__init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringComplex | pauliengine._core.SparsePauliStringComplex]) -> None
From a list that mixes sparse Pauli strings and Pauli strings with bit vectors.
__init__(self, data: collections.abc.Sequence[tuple[complex, collections.abc.Mapping[int, str]]]) -> None
From a list of (coefficient, {qubit: ‘X’/’Y’/’Z’}) pairs.
__init__(self, hamiltonian: pauliengine._core.PauliStringSumComplex) -> None
The same operator as a Hamiltonian with bit vectors.
- __len__(self) int¶
Number of terms.
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object¶
- __mul__(self, scale: int) pauliengine._core.SparsePauliStringSumComplex
- __mul__(self, scale: float) pauliengine._core.SparsePauliStringSumComplex
- __mul__(self, scale: complex) pauliengine._core.SparsePauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.SparsePauliStringSumSymbolic
Overloaded function.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product; h * h uses the square formula (only commuting pairs, each once). With bit vectors if the result no longer fits the sparse representation.
__mul__(self, scale: int) -> pauliengine._core.SparsePauliStringSumComplex
Every coefficient scaled by an int, float or complex number; scaling by 0 gives the zero operator.
__mul__(self, scale: float) -> pauliengine._core.SparsePauliStringSumComplex
Every coefficient scaled by an int, float or complex number; scaling by 0 gives the zero operator.
__mul__(self, scale: complex) -> pauliengine._core.SparsePauliStringSumComplex
Every coefficient scaled by an int, float or complex number; scaling by 0 gives the zero operator.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.SparsePauliStringSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object¶
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
Overloaded function.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object¶
- commutator(self, other: pauliengine._core.PauliStringComplex) object
- commutator(self, other: pauliengine._core.PauliStringSymbolic) object
- commutator(self, other: pauliengine._core.PauliStringSumComplex) object
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.PauliCycleComplex) object
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) object
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) object
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) object
- commutator(self, other: pauliengine._core.PauliOrbit) object
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) object
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) object
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) object
Overloaded function.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other]; only pairs sharing a qubit are visited when they are few.
commutator(self, other: pauliengine._core.PauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> object
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> object
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- compact(self) pauliengine._core.SparsePauliStringSumComplex¶
The sum is always compacted; returns a copy.
- conjugate(self) pauliengine._core.SparsePauliStringSumComplex¶
Complex conjugate: conjugates each coefficient, sign flipped for an odd number of Y.
- contains(self, pauli_string: pauliengine._core.SparsePauliStringComplex) complex¶
- contains(self, pauli_string: pauliengine._core.PauliStringComplex) complex
- contains(self, pauli_string: collections.abc.Mapping[int, str]) complex
Overloaded function.
contains(self, pauli_string: pauliengine._core.SparsePauliStringComplex) -> complex
Coefficient of the given Pauli string’s operator (0 if absent).
contains(self, pauli_string: pauliengine._core.PauliStringComplex) -> complex
Coefficient of the given Pauli string’s operator (0 if absent).
contains(self, pauli_string: collections.abc.Mapping[int, str]) -> complex
Coefficient of the Pauli string {qubit: ‘X’} (0 if absent).
- count_measurements(self) int¶
1 if is_all_z(), else the number of terms.
- dagger(self) pauliengine._core.SparsePauliStringSumComplex¶
Hermitian conjugate: complex-conjugates each coefficient.
- fits_sparse(self) bool¶
Whether the operator still fits the sparse representation; results of arithmetic that do not are returned with bit vectors.
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_all_z(self) bool¶
True if all terms are products of Z operators only.
- is_antihermitian(self) bool¶
True if every coefficient is purely imaginary (abs(real) <= 1e-12).
- is_hermitian(self) bool¶
True if every coefficient is real (abs(imag) <= 1e-12).
- map_qubits(self, arg: collections.abc.Mapping[int, int], /) pauliengine._core.SparsePauliStringSumComplex¶
Copy with qubit indices remapped by {old: new}.
- n_qubits(self) int¶
Number of qubits acted on non-trivially.
- paulistrings(self) list[pauliengine._core.SparsePauliStringComplex]¶
The terms as sparse Pauli strings.
- power(self, arg: int, /) object¶
Raise to a non-negative integer power; continues with bit vectors once a power no longer fits the sparse representation.
- qubits(self) list[int]¶
Sorted list of the qubits acted on non-trivially.
- set_all_coeff(self, value: complex) pauliengine._core.SparsePauliStringSumComplex¶
Copy with every coefficient replaced by value.
- simplify(self, threshold: float = 0.0) pauliengine._core.SparsePauliStringSumComplex¶
Copy without the terms whose abs(coefficient) <= threshold.
- size(self) int¶
Number of terms.
- split(self) tuple[pauliengine._core.SparsePauliStringSumComplex, pauliengine._core.SparsePauliStringSumComplex]¶
Split into (hermitian, anti-hermitian) parts; needs numeric coefficients.
- square(self) object¶
self * self, visiting each commuting pair once.
- targeted_commutator(self, other: pauliengine._core.SparsePauliStringSumComplex, target: pauliengine._core.SparsePauliStringComplex) complex¶
- targeted_commutator(self, other: pauliengine._core.SparsePauliStringComplex, target: pauliengine._core.SparsePauliStringComplex) complex
- targeted_commutator(self, other: pauliengine._core.SparsePauliStringSumComplex, target: pauliengine._core.PauliStringComplex) complex
Overloaded function.
targeted_commutator(self, other: pauliengine._core.SparsePauliStringSumComplex, target: pauliengine._core.SparsePauliStringComplex) -> complex
Coefficient of target’s operator in [self, other], via a hash join.
targeted_commutator(self, other: pauliengine._core.SparsePauliStringComplex, target: pauliengine._core.SparsePauliStringComplex) -> complex
Coefficient of target’s operator in [self, other] for a single string other.
targeted_commutator(self, other: pauliengine._core.SparsePauliStringSumComplex, target: pauliengine._core.PauliStringComplex) -> complex
Coefficient of target’s operator in [self, other], via a hash join.
- to_dense(self) pauliengine._core.PauliStringSumComplex¶
The operator as a PauliStringSum with bit vectors.
- to_dictionary(self) list[tuple[complex, dict[int, str]]]¶
List of (coefficient, {qubit: Pauli}) pairs.
- to_list(self) list[pauliengine._core.SparsePauliStringComplex]¶
The terms as sparse Pauli strings (same as paulistrings()).
- to_matrix(self, ignore_unused_qubits: bool = True) list[list[complex]]¶
Dense 2**N x 2**N matrix (see PauliStringSum.to_matrix).
- to_string(self) str¶
Human-readable form, one term per line.
- trace_out_qubits(self, qubits: collections.abc.Sequence[int], state: collections.abc.Sequence[int]) pauliengine._core.SparsePauliStringSumComplex¶
- trace_out_qubits(self, qubits: collections.abc.Sequence[int], states: collections.abc.Sequence[tuple[complex, complex]]) pauliengine._core.SparsePauliStringSumComplex
Overloaded function.
trace_out_qubits(self, qubits: collections.abc.Sequence[int], state: collections.abc.Sequence[int]) -> pauliengine._core.SparsePauliStringSumComplex
Trace out the given qubits in computational basis states.
trace_out_qubits(self, qubits: collections.abc.Sequence[int], states: collections.abc.Sequence[tuple[complex, complex]]) -> pauliengine._core.SparsePauliStringSumComplex
Trace out the given qubits in states a|0> + b|1>.
- transpose(self) pauliengine._core.SparsePauliStringSumComplex¶
Transpose: sign flipped for an odd number of Y.
- __hash__ = None¶
- from_matrix = <nanobind.nb_func object>¶
- unit = <nanobind.nb_func object>¶
- zero = <nanobind.nb_func object>¶
- class pauliengine._core.SparsePauliStringSumSymbolic(*args, **kwargs)¶
Bases:
objectA sum of sparse Pauli strings with symbolic coefficients. Kept compacted.
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object¶
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.PauliOrbit, /) object
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
Overloaded function.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __contains__(self, pauli_string: pauliengine._core.SparsePauliStringSymbolic) bool¶
- __contains__(self, pauli_string: pauliengine._core.PauliStringSymbolic) bool
True if the operator has a non-zero term.
- __eq__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) bool¶
- __eq__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) bool
- __eq__(self, arg: pauliengine._core.PauliStringSumComplex, /) bool
- __eq__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> bool
True if both have the same terms with equal coefficients (order-independent).
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self, data: collections.abc.Sequence[pauliengine._core.SparsePauliStringSymbolic]) None¶
- __init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringSymbolic]) None
- __init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringSymbolic | pauliengine._core.SparsePauliStringSymbolic]) None
- __init__(self, data: collections.abc.Sequence[tuple[pauliengine._core.Expression, collections.abc.Mapping[int, str]]]) None
- __init__(self, hamiltonian: pauliengine._core.PauliStringSumSymbolic) None
Overloaded function.
__init__(self, data: collections.abc.Sequence[pauliengine._core.SparsePauliStringSymbolic]) -> None
From a list of sparse Pauli strings (equal operators are merged).
__init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringSymbolic]) -> None
From a list of Pauli strings with bit vectors.
__init__(self, data: collections.abc.Sequence[pauliengine._core.PauliStringSymbolic | pauliengine._core.SparsePauliStringSymbolic]) -> None
From a list that mixes sparse Pauli strings and Pauli strings with bit vectors.
__init__(self, data: collections.abc.Sequence[tuple[pauliengine._core.Expression, collections.abc.Mapping[int, str]]]) -> None
From a list of (coefficient, {qubit: ‘X’/’Y’/’Z’}) pairs.
__init__(self, hamiltonian: pauliengine._core.PauliStringSumSymbolic) -> None
The same operator as a Hamiltonian with bit vectors.
- __len__(self) int¶
Number of terms.
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object¶
- __mul__(self, scale: int) pauliengine._core.SparsePauliStringSumSymbolic
- __mul__(self, scale: float) pauliengine._core.SparsePauliStringSumSymbolic
- __mul__(self, scale: complex) pauliengine._core.SparsePauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.SparsePauliStringSumSymbolic
Overloaded function.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product; h * h uses the square formula (only commuting pairs, each once). With bit vectors if the result no longer fits the sparse representation.
__mul__(self, scale: int) -> pauliengine._core.SparsePauliStringSumSymbolic
Every coefficient scaled by an int, float or complex number; scaling by 0 gives the zero operator.
__mul__(self, scale: float) -> pauliengine._core.SparsePauliStringSumSymbolic
Every coefficient scaled by an int, float or complex number; scaling by 0 gives the zero operator.
__mul__(self, scale: complex) -> pauliengine._core.SparsePauliStringSumSymbolic
Every coefficient scaled by an int, float or complex number; scaling by 0 gives the zero operator.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.SparsePauliStringSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object¶
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) object
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) object
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) object
Overloaded function.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> object
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> object
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object¶
- commutator(self, other: pauliengine._core.PauliStringComplex) object
- commutator(self, other: pauliengine._core.PauliStringSymbolic) object
- commutator(self, other: pauliengine._core.PauliStringSumComplex) object
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.PauliCycleComplex) object
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) object
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) object
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) object
- commutator(self, other: pauliengine._core.PauliOrbit) object
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) object
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) object
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) object
Overloaded function.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other]; only pairs sharing a qubit are visited when they are few.
commutator(self, other: pauliengine._core.PauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> object
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> object
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- compact(self) pauliengine._core.SparsePauliStringSumSymbolic¶
The sum is always compacted; returns a copy.
- conjugate(self) pauliengine._core.SparsePauliStringSumSymbolic¶
Complex conjugate: conjugates each coefficient, sign flipped for an odd number of Y.
- contains(self, pauli_string: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression¶
- contains(self, pauli_string: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- contains(self, pauli_string: collections.abc.Mapping[int, str]) pauliengine._core.Expression
Overloaded function.
contains(self, pauli_string: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Coefficient of the given Pauli string’s operator (0 if absent).
contains(self, pauli_string: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Coefficient of the given Pauli string’s operator (0 if absent).
contains(self, pauli_string: collections.abc.Mapping[int, str]) -> pauliengine._core.Expression
Coefficient of the Pauli string {qubit: ‘X’} (0 if absent).
- count_measurements(self) int¶
1 if is_all_z(), else the number of terms.
- dagger(self) pauliengine._core.SparsePauliStringSumSymbolic¶
Hermitian conjugate: complex-conjugates each coefficient.
- diff(self, symbol: str) pauliengine._core.SparsePauliStringSumSymbolic¶
Derivative of every coefficient with respect to the named symbol.
- fits_sparse(self) bool¶
Whether the operator still fits the sparse representation; results of arithmetic that do not are returned with bit vectors.
- inner_product(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.Expression¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.Expression
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_all_z(self) bool¶
True if all terms are products of Z operators only.
- is_antihermitian(self) bool¶
True if every coefficient is purely imaginary (abs(real) <= 1e-12).
- is_hermitian(self) bool¶
True if every coefficient is real (abs(imag) <= 1e-12).
- map_qubits(self, arg: collections.abc.Mapping[int, int], /) pauliengine._core.SparsePauliStringSumSymbolic¶
Copy with qubit indices remapped by {old: new}.
- n_qubits(self) int¶
Number of qubits acted on non-trivially.
- paulistrings(self) list[pauliengine._core.SparsePauliStringSymbolic]¶
The terms as sparse Pauli strings.
- power(self, arg: int, /) object¶
Raise to a non-negative integer power; continues with bit vectors once a power no longer fits the sparse representation.
- qubits(self) list[int]¶
Sorted list of the qubits acted on non-trivially.
- set_all_coeff(self, value: pauliengine._core.Expression) pauliengine._core.SparsePauliStringSumSymbolic¶
Copy with every coefficient replaced by value.
- simplify(self, threshold: float = 0.0) pauliengine._core.SparsePauliStringSumSymbolic¶
Copy without the terms whose abs(coefficient) <= threshold.
- size(self) int¶
Number of terms.
- split(self) tuple[pauliengine._core.SparsePauliStringSumSymbolic, pauliengine._core.SparsePauliStringSumSymbolic]¶
Split into (hermitian, anti-hermitian) parts; needs numeric coefficients.
- square(self) object¶
self * self, visiting each commuting pair once.
- subs(self, values: collections.abc.Mapping[str, complex | str | pauliengine._core.Expression]) pauliengine._core.SparsePauliStringSumSymbolic¶
Substitute values for symbols, given as {name: value}. A value is a number, an Expression or a polynomial as text such as ‘b + 2*c’; all symbols are replaced at once, so {‘a’: ‘b’, ‘b’: ‘a’} swaps them. Symbols without a value stay.
- targeted_commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic, target: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression¶
- targeted_commutator(self, other: pauliengine._core.SparsePauliStringSymbolic, target: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- targeted_commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic, target: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
Overloaded function.
targeted_commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic, target: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Coefficient of target’s operator in [self, other], via a hash join.
targeted_commutator(self, other: pauliengine._core.SparsePauliStringSymbolic, target: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Coefficient of target’s operator in [self, other] for a single string other.
targeted_commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic, target: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Coefficient of target’s operator in [self, other], via a hash join.
- to_dense(self) pauliengine._core.PauliStringSumSymbolic¶
The operator as a PauliStringSum with bit vectors.
- to_dictionary(self) list[tuple[pauliengine._core.Expression, dict[int, str]]]¶
List of (coefficient, {qubit: Pauli}) pairs.
- to_list(self) list[pauliengine._core.SparsePauliStringSymbolic]¶
The terms as sparse Pauli strings (same as paulistrings()).
- to_matrix(self, ignore_unused_qubits: bool = True) list[list[complex]]¶
Dense 2**N x 2**N matrix (see PauliStringSum.to_matrix).
- to_string(self) str¶
Human-readable form, one term per line.
- trace_out_qubits(self, qubits: collections.abc.Sequence[int], state: collections.abc.Sequence[int]) pauliengine._core.SparsePauliStringSumSymbolic¶
- trace_out_qubits(self, qubits: collections.abc.Sequence[int], states: collections.abc.Sequence[tuple[complex, complex]]) pauliengine._core.SparsePauliStringSumSymbolic
Overloaded function.
trace_out_qubits(self, qubits: collections.abc.Sequence[int], state: collections.abc.Sequence[int]) -> pauliengine._core.SparsePauliStringSumSymbolic
Trace out the given qubits in computational basis states.
trace_out_qubits(self, qubits: collections.abc.Sequence[int], states: collections.abc.Sequence[tuple[complex, complex]]) -> pauliengine._core.SparsePauliStringSumSymbolic
Trace out the given qubits in states a|0> + b|1>.
- transpose(self) pauliengine._core.SparsePauliStringSumSymbolic¶
Transpose: sign flipped for an odd number of Y.
- __hash__ = None¶
- unit = <nanobind.nb_func object>¶
- zero = <nanobind.nb_func object>¶
Pauli cycles¶
pauliengine.PauliCycle and pauliengine.PauliCycleSum build the complex or,
for a symbolic coefficient such as "a*b", the symbolic class below;
isinstance(x, pauliengine.PauliCycle) accepts both.
- class pauliengine.pauli_cycle.PauliCycleFactory[source]¶
Bases:
_CoefficientFactoryFactory behind
pauliengine.PauliCycle.Builds a
PauliCycleComplexor, for a symbolic coefficient (a string such as"a*b"or anExpression) or a symbolic base string, aPauliCycleSymbolic:PauliCycle(4, "XZ") # coefficient 1 PauliCycle(4, {0: "X", 1: "Z"}, 0.5) PauliCycle(4, "XZ", "a") # symbolic coefficient a PauliCycle(4, PauliString("a", "XZ")) # base with its coefficient (also sparse)
- class pauliengine._core.PauliCycleComplex(*args, **kwargs)¶
Bases:
objectA Pauli string with a complex coefficient together with all of its cyclic rotations on n_qubits qubits, C(P) = coeff * sum_k R^k P. The sum runs over all n rotations, so a base with a shorter period counts each distinct rotation several times.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __eq__(self, arg: pauliengine._core.PauliCycleComplex, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliCycleSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliCycleComplex, /) -> bool
True if both describe the same rotation orbit on the same n_qubits; coefficients are ignored.
__eq__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> bool
True if both describe the same rotation orbit on the same n_qubits; coefficients are ignored.
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __hash__(self) int¶
Fixed-size hash, consistent with == (rotation-invariant, coefficient ignored).
- __init__(self, n_qubits: int, data: collections.abc.Mapping[int, str], coeff: complex = 1 + 0j) None¶
- __init__(self, n_qubits: int, pauli_string: str, coeff: complex = 1 + 0j) None
- __init__(self, n_qubits: int, base: pauliengine._core.PauliStringComplex) None
- __init__(self, n_qubits: int, base: pauliengine._core.SparsePauliStringComplex) None
Overloaded function.
__init__(self, n_qubits: int, data: collections.abc.Mapping[int, str], coeff: complex = (1+0j)) -> None
From a qubit count, a base {qubit: ‘X’/’Y’/’Z’} and a coefficient. Raises ValueError if n_qubits < 1 or the base acts on a qubit >= n_qubits.
__init__(self, n_qubits: int, pauli_string: str, coeff: complex = (1+0j)) -> None
From a qubit count, a dense base string such as ‘XIY’ and a coefficient.
__init__(self, n_qubits: int, base: pauliengine._core.PauliStringComplex) -> None
From a qubit count and a base PauliString (its coefficient becomes the cycle’s).
__init__(self, n_qubits: int, base: pauliengine._core.SparsePauliStringComplex) -> None
From a qubit count and a sparse base Pauli string (its coefficient becomes the cycle’s).
- __mul__(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliCycleSumComplex¶
- __mul__(self, scale: int) pauliengine._core.PauliCycleComplex
- __mul__(self, scale: float) pauliengine._core.PauliCycleComplex
- __mul__(self, scale: complex) pauliengine._core.PauliCycleComplex
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliCycleSymbolic
Overloaded function.
__mul__(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliCycleSumComplex
Product self * other as a PauliCycleSum (at most n_qubits summands after merging).
__mul__(self, scale: int) -> pauliengine._core.PauliCycleComplex
The cycle with its coefficient scaled by an int, float or complex number.
__mul__(self, scale: float) -> pauliengine._core.PauliCycleComplex
The cycle with its coefficient scaled by an int, float or complex number.
__mul__(self, scale: complex) -> pauliengine._core.PauliCycleComplex
The cycle with its coefficient scaled by an int, float or complex number.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliCycleSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliCycleSumComplex¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliCycleSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumComplex
Overloaded function.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliCycleSumComplex
Commutator [self, other] as a PauliCycleSum (Eq. 40). Only shifts at which the supports overlap contribute, so it is cheap for bounded weight. Raises ValueError on an n_qubits mismatch.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliCycleSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- get_hash(self) int¶
Invertible int key of the cycle (coefficient ignored, identical for all rotations): PauliString.get_hash() of the unified representative * 2**32 + n_qubits.
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- period(self) int¶
Number of distinct rotations d of the base (d divides n_qubits); the cycle counts each distinct rotation n_qubits / d times.
- rotate(self, k: int) pauliengine._core.PauliStringComplex¶
The stored base shifted by k qubits, new[(i + k) mod n] = old[i] (k may be negative or >= n_qubits).
- rotations(self) list[pauliengine._core.PauliStringComplex]¶
All n_qubits rotations rotate(0), …, rotate(n - 1) of the stored base.
- targeted_commutator(self, other: pauliengine._core.PauliCycleComplex, target: pauliengine._core.PauliCycleComplex) complex¶
- targeted_commutator(self, other: pauliengine._core.PauliCycleComplex, target: pauliengine._core.PauliCycleSymbolic) complex
Coefficient of target’s orbit in [self, other], without building the full commutator; target’s coefficient is ignored.
- to_pauli_string_sum(self) pauliengine._core.PauliStringSumComplex¶
The cycle expanded into a PauliStringSum (the sum of all n rotations).
- unify(self) None¶
Rotate the base to the unified orbit representative. Optional: ==/hash are rotation-invariant on their own; this only changes the stored base.
- property base¶
The stored base Pauli string (as constructed, or unified after unify(); the summands of products and commutators of cycle sums with sparse bases are unified already); carries the coefficient.
- from_hash = <nanobind.nb_func object>¶
- property n_qubits¶
Number of qubits (read-only).
- class pauliengine._core.PauliCycleSymbolic(*args, **kwargs)¶
Bases:
objectA Pauli string with a symbolic (polynomial) coefficient together with all of its cyclic rotations on n_qubits qubits, C(P) = coeff * sum_k R^k P.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __eq__(self, arg: pauliengine._core.PauliCycleComplex, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliCycleSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliCycleComplex, /) -> bool
True if both describe the same rotation orbit on the same n_qubits; coefficients are ignored.
__eq__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> bool
True if both describe the same rotation orbit on the same n_qubits; coefficients are ignored.
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __hash__(self) int¶
Fixed-size hash, consistent with == (rotation-invariant, coefficient ignored).
- __init__(self, n_qubits: int, data: collections.abc.Mapping[int, str], coeff: pauliengine._core.Expression = 1) None¶
- __init__(self, n_qubits: int, pauli_string: str, coeff: pauliengine._core.Expression = 1) None
- __init__(self, n_qubits: int, base: pauliengine._core.PauliStringSymbolic) None
- __init__(self, n_qubits: int, base: pauliengine._core.SparsePauliStringSymbolic) None
Overloaded function.
__init__(self, n_qubits: int, data: collections.abc.Mapping[int, str], coeff: pauliengine._core.Expression = 1) -> None
From a qubit count, a base {qubit: ‘X’/’Y’/’Z’} and a coefficient. Raises ValueError if n_qubits < 1 or the base acts on a qubit >= n_qubits.
__init__(self, n_qubits: int, pauli_string: str, coeff: pauliengine._core.Expression = 1) -> None
From a qubit count, a dense base string such as ‘XIY’ and a coefficient.
__init__(self, n_qubits: int, base: pauliengine._core.PauliStringSymbolic) -> None
From a qubit count and a base PauliString (its coefficient becomes the cycle’s).
__init__(self, n_qubits: int, base: pauliengine._core.SparsePauliStringSymbolic) -> None
From a qubit count and a sparse base Pauli string (its coefficient becomes the cycle’s).
- __mul__(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliCycleSumSymbolic¶
- __mul__(self, scale: int) pauliengine._core.PauliCycleSymbolic
- __mul__(self, scale: float) pauliengine._core.PauliCycleSymbolic
- __mul__(self, scale: complex) pauliengine._core.PauliCycleSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliCycleSymbolic
Overloaded function.
__mul__(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Product self * other as a PauliCycleSum (at most n_qubits summands after merging).
__mul__(self, scale: int) -> pauliengine._core.PauliCycleSymbolic
The cycle with its coefficient scaled by an int, float or complex number.
__mul__(self, scale: float) -> pauliengine._core.PauliCycleSymbolic
The cycle with its coefficient scaled by an int, float or complex number.
__mul__(self, scale: complex) -> pauliengine._core.PauliCycleSymbolic
The cycle with its coefficient scaled by an int, float or complex number.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliCycleSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliCycleSumSymbolic¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] as a PauliCycleSum (Eq. 40). Only shifts at which the supports overlap contribute, so it is cheap for bounded weight. Raises ValueError on an n_qubits mismatch.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- diff(self, symbol: str) pauliengine._core.PauliCycleSymbolic¶
Derivative of the coefficient with respect to the named symbol.
- get_hash(self) int¶
Invertible int key of the cycle (coefficient ignored, identical for all rotations): PauliString.get_hash() of the unified representative * 2**32 + n_qubits.
- inner_product(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.Expression¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.Expression
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- period(self) int¶
Number of distinct rotations d of the base (d divides n_qubits); the cycle counts each distinct rotation n_qubits / d times.
- rotate(self, k: int) pauliengine._core.PauliStringSymbolic¶
The stored base shifted by k qubits, new[(i + k) mod n] = old[i] (k may be negative or >= n_qubits).
- rotations(self) list[pauliengine._core.PauliStringSymbolic]¶
All n_qubits rotations rotate(0), …, rotate(n - 1) of the stored base.
- subs(self, values: collections.abc.Mapping[str, complex | str | pauliengine._core.Expression]) pauliengine._core.PauliCycleSymbolic¶
Substitute values for symbols, given as {name: value}. A value is a number, an Expression or a polynomial as text such as ‘b + 2*c’; all symbols are replaced at once, so {‘a’: ‘b’, ‘b’: ‘a’} swaps them. Symbols without a value stay.
- targeted_commutator(self, other: pauliengine._core.PauliCycleSymbolic, target: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression¶
- targeted_commutator(self, other: pauliengine._core.PauliCycleSymbolic, target: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
Coefficient of target’s orbit in [self, other], without building the full commutator; target’s coefficient is ignored.
- to_pauli_string_sum(self) pauliengine._core.PauliStringSumSymbolic¶
The cycle expanded into a PauliStringSum (the sum of all n rotations).
- unify(self) None¶
Rotate the base to the unified orbit representative. Optional: ==/hash are rotation-invariant on their own; this only changes the stored base.
- property base¶
The stored base Pauli string (as constructed, or unified after unify(); the summands of products and commutators of cycle sums with sparse bases are unified already); carries the coefficient.
- from_hash = <nanobind.nb_func object>¶
- property n_qubits¶
Number of qubits (read-only).
- class pauliengine._core.PauliCycleSumComplex(*args, **kwargs)¶
Bases:
objectA sum of PauliCycles with complex coefficients; each cycle carries its own coefficient. Summands from the same rotation orbit are always merged.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __contains__(self, cycle: pauliengine._core.PauliCycleComplex) bool¶
- __contains__(self, cycle: pauliengine._core.PauliCycleSymbolic) bool
True if a summand lies in the same rotation orbit as cycle.
- __eq__(self, arg: pauliengine._core.PauliCycleSumComplex, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> bool
True if both have the same summands with equal coefficients.
__eq__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> bool
True if both have the same summands with equal coefficients.
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self, data: collections.abc.Sequence[pauliengine._core.PauliCycleComplex]) None¶
Construct from a list of cycles (cycles in the same rotation orbit are merged, zeros dropped).
- __len__(self) int¶
Number of summands.
- __mul__(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliCycleSumComplex¶
- __mul__(self, scale: int) pauliengine._core.PauliCycleSumComplex
- __mul__(self, scale: float) pauliengine._core.PauliCycleSumComplex
- __mul__(self, scale: complex) pauliengine._core.PauliCycleSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliCycleSumSymbolic
Overloaded function.
__mul__(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliCycleSumComplex
Product self * other = sum_ij c_i d_j, merged.
__mul__(self, scale: int) -> pauliengine._core.PauliCycleSumComplex
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: float) -> pauliengine._core.PauliCycleSumComplex
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: complex) -> pauliengine._core.PauliCycleSumComplex
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliCycleSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliCycleSumComplex¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliCycleSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumComplex
Overloaded function.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliCycleSumComplex
Commutator [self, other] = sum_ij [c_i, d_j], merged.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliCycleSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- contains(self, cycle: pauliengine._core.PauliCycleComplex) complex¶
- contains(self, cycle: pauliengine._core.PauliCycleSymbolic) complex
Coefficient of the summand in the same rotation orbit as cycle (0 if absent); the coefficient of cycle itself is ignored.
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- targeted_commutator(self, other: pauliengine._core.PauliCycleSumComplex, target: pauliengine._core.PauliCycleComplex) complex¶
- targeted_commutator(self, other: pauliengine._core.PauliCycleSumComplex, target: pauliengine._core.PauliCycleSymbolic) complex
Coefficient of target’s orbit in [self, other], without building the full commutator.
- to_pauli_string_sum(self) pauliengine._core.PauliStringSumComplex¶
The sum expanded into a PauliStringSum.
- unify(self) None¶
Rewrite every summand’s base to the unified representative of its orbit, in place. Cheap: the unified forms are already computed when the sum is merged.
- __hash__ = None¶
- property data¶
The summands; no two lie in the same rotation orbit.
- class pauliengine._core.PauliCycleSumSymbolic(*args, **kwargs)¶
Bases:
objectA sum of PauliCycles with symbolic coefficients; each cycle carries its own coefficient. Summands from the same rotation orbit are always merged.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __contains__(self, cycle: pauliengine._core.PauliCycleComplex) bool¶
- __contains__(self, cycle: pauliengine._core.PauliCycleSymbolic) bool
True if a summand lies in the same rotation orbit as cycle.
- __eq__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliCycleSumComplex, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> bool
True if both have the same summands with equal coefficients.
__eq__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> bool
True if both have the same summands with equal coefficients.
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self, data: collections.abc.Sequence[pauliengine._core.PauliCycleSymbolic]) None¶
Construct from a list of cycles (cycles in the same rotation orbit are merged, zeros dropped).
- __len__(self) int¶
Number of summands.
- __mul__(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliCycleSumSymbolic¶
- __mul__(self, scale: int) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, scale: float) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, scale: complex) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliCycleSumSymbolic
Overloaded function.
__mul__(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Product self * other = sum_ij c_i d_j, merged.
__mul__(self, scale: int) -> pauliengine._core.PauliCycleSumSymbolic
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: float) -> pauliengine._core.PauliCycleSumSymbolic
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: complex) -> pauliengine._core.PauliCycleSumSymbolic
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliCycleSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliCycleSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliCycleSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliCycleSumSymbolic¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliCycleSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] = sum_ij [c_i, d_j], merged.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliCycleSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- contains(self, cycle: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression¶
- contains(self, cycle: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
Coefficient of the summand in the same rotation orbit as cycle (0 if absent); the coefficient of cycle itself is ignored.
- diff(self, symbol: str) pauliengine._core.PauliCycleSumSymbolic¶
Derivative of every coefficient with respect to the named symbol; summands that become zero are dropped.
- inner_product(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.Expression¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.Expression
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- subs(self, values: collections.abc.Mapping[str, complex | str | pauliengine._core.Expression]) pauliengine._core.PauliCycleSumSymbolic¶
Substitute values for symbols (see PauliStringSymbolic.subs); summands that become zero are dropped.
- targeted_commutator(self, other: pauliengine._core.PauliCycleSumSymbolic, target: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression¶
- targeted_commutator(self, other: pauliengine._core.PauliCycleSumSymbolic, target: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
Coefficient of target’s orbit in [self, other], without building the full commutator.
- to_pauli_string_sum(self) pauliengine._core.PauliStringSumSymbolic¶
The sum expanded into a PauliStringSum.
- unify(self) None¶
Rewrite every summand’s base to the unified representative of its orbit, in place. Cheap: the unified forms are already computed when the sum is merged.
- __hash__ = None¶
- property data¶
The summands; no two lie in the same rotation orbit.
Pauli orbits¶
An orbit has no coefficient of its own. pauliengine.PauliOrbitSum builds a sum
with complex or symbolic coefficients; isinstance(x, pauliengine.PauliOrbitSum)
accepts both.
- class pauliengine.PauliOrbit(*args, **kwargs)¶
Bases:
objectA permutation-invariant Pauli orbit B_{p,q,r} on n qubits: the normalized sum (i / n_terms) * sum of all Pauli strings with p X-, q Y- and r Z-sites.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliOrbitSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliOrbitSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliOrbitSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliOrbitSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliOrbitSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliOrbitSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __eq__(self, arg: pauliengine._core.PauliOrbit, /) bool¶
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliOrbit, /) -> bool
True if n_qubits and the label (p, q, r) agree.
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __hash__(self) int¶
Fixed-size hash, consistent with ==.
- __init__(self, n_qubits: int, p: int, q: int, r: int) None¶
The orbit with p X-, q Y- and r Z-sites on n_qubits qubits. Raises ValueError unless 0 <= n_qubits <= max_qubits, p, q, r >= 0 and p + q + r <= n_qubits.
- __mul__(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliOrbitSumComplex¶
- __mul__(self, scale: int) pauliengine._core.PauliOrbitSumComplex
- __mul__(self, scale: float) pauliengine._core.PauliOrbitSumComplex
- __mul__(self, scale: complex) pauliengine._core.PauliOrbitSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliOrbitSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliOrbitSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliOrbitSumSymbolic
Overloaded function.
__mul__(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliOrbitSumComplex
Product self * other as a PauliOrbitSum (complex coefficients).
__mul__(self, scale: int) -> pauliengine._core.PauliOrbitSumComplex
scale * self as a PauliOrbitSum, for an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: float) -> pauliengine._core.PauliOrbitSumComplex
scale * self as a PauliOrbitSum, for an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: complex) -> pauliengine._core.PauliOrbitSumComplex
scale * self as a PauliOrbitSum, for an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliOrbitSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliOrbitSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliOrbitSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliOrbitSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliOrbitSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliOrbitSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliOrbitSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliOrbitSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliOrbitSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliOrbitSumComplex¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliOrbitSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliOrbitSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumComplex
Overloaded function.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliOrbitSumComplex
Commutator [self, other] as a PauliOrbitSum (Theorem 1), without expanding the strings. Raises ValueError on an n_qubits mismatch.
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliOrbitSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliOrbitSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- get_hash(self) int¶
Invertible int key of the orbit label: n * 2**24 + p * 2**16 + q * 2**8 + r.
- identities(self) int¶
Number of identity sites, n - p - q - r.
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- is_valid(self) bool¶
Whether p, q, r >= 0 and p + q + r <= n_qubits; always True, since the constructor rejects anything else.
- n_terms(self) float¶
Number of distinct Pauli strings in the orbit, n! / (p! q! r! (n-p-q-r)!) (Eq. 52).
- targeted_commutator(self, other: pauliengine._core.PauliOrbit, target: pauliengine._core.PauliOrbit) complex¶
Coefficient of target in [self, other] (Corollary 5 / Algorithm 2), as a complex number with zero imaginary part; O(1) for bounded weights.
- to_pauli_string_sum(self) pauliengine._core.PauliStringSumComplex¶
The orbit expanded into a PauliStringSum, (i / n_terms) * sum of its Pauli strings. Raises an error above 2e7 strings.
- from_hash = <nanobind.nb_func object>¶
- max_qubits = 170¶
- property n_qubits¶
Number of qubits (read-only).
- property p¶
Number of X sites (read-only).
- property q¶
Number of Y sites (read-only).
- property r¶
Number of Z sites (read-only).
- class pauliengine.pauli_orbit.PauliOrbitSumFactory[source]¶
Bases:
_CoefficientFactoryFactory behind
pauliengine.PauliOrbitSum.Builds an empty or filled sum of orbits on
n_qubitsqubits:PauliOrbitSum(4) # empty, complex coefficients PauliOrbitSum(4, symbolic=True) # empty, symbolic coefficients PauliOrbitSum(4, [(PauliOrbit(4, 1, 0, 0), 0.5)]) # complex PauliOrbitSum(4, [(PauliOrbit(4, 1, 0, 0), "a")]) # symbolic
The sum is symbolic if
symbolicis true or any coefficient is a string such as"a*b"or anExpression. Terms with the same label are merged.
- class pauliengine._core.PauliOrbitSumComplex(*args, **kwargs)¶
Bases:
objectA weighted sum of Pauli orbits with complex coefficients, sum_i coeffs[i] * data[i], on a fixed number of qubits.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliOrbitSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliOrbitSumComplex
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliOrbitSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliOrbitSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliOrbitSumComplex
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliOrbitSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __contains__(self, orbit: pauliengine._core.PauliOrbit) bool¶
True if orbit occurs in the sum with a non-zero coefficient.
- __eq__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> bool
True if both have the same summands with equal coefficients.
__eq__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> bool
True if both have the same summands with equal coefficients.
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self, n_qubits: int) None¶
The empty sum on n_qubits qubits. Raises ValueError unless 0 <= n_qubits <= PauliOrbit.max_qubits.
- __len__(self) int¶
Number of terms.
- __mul__(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliOrbitSumComplex¶
- __mul__(self, scale: int) pauliengine._core.PauliOrbitSumComplex
- __mul__(self, scale: float) pauliengine._core.PauliOrbitSumComplex
- __mul__(self, scale: complex) pauliengine._core.PauliOrbitSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliOrbitSumComplex
- __mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliOrbitSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliOrbitSumSymbolic
Overloaded function.
__mul__(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliOrbitSumComplex
Product self * other = sum_ij a_i b_j B_i B_j.
__mul__(self, scale: int) -> pauliengine._core.PauliOrbitSumComplex
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: float) -> pauliengine._core.PauliOrbitSumComplex
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: complex) -> pauliengine._core.PauliOrbitSumComplex
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliOrbitSumComplex
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliOrbitSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliOrbitSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumComplex¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliOrbitSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliOrbitSumComplex
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliOrbitSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumComplex
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumComplex
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliOrbitSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliOrbitSumComplex
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliOrbitSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumComplex
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- add(self, orbit: pauliengine._core.PauliOrbit, coeff: complex) None¶
Add coeff * orbit in place, merging into an existing term with the same label. Raises ValueError if orbit.n_qubits differs.
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliOrbitSumComplex¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliOrbitSumComplex
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliOrbitSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumComplex
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumComplex
Overloaded function.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliOrbitSumComplex
Commutator [self, other] = sum_ij a_i b_j [B_i, B_j].
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliOrbitSumComplex
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliOrbitSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumComplex
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- contains(self, orbit: pauliengine._core.PauliOrbit) complex¶
Coefficient of orbit in the sum (0 if absent).
- inner_product(self, other: pauliengine._core.PauliStringComplex) complex¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) complex
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) complex
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) complex
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) complex
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> complex
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> complex
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- prune_zeros(self) None¶
Drop terms whose coefficient is zero, in place.
- targeted_commutator(self, other: pauliengine._core.PauliOrbitSumComplex, target: pauliengine._core.PauliOrbit) complex¶
Coefficient of target in [self, other], without building the full commutator.
- to_pauli_string_sum(self) pauliengine._core.PauliStringSumComplex¶
The sum expanded into a PauliStringSum.
- __hash__ = None¶
- property coeffs¶
The list of coefficients, parallel to data.
- property data¶
The orbits; each label occurs at most once.
- property n_qubits¶
Number of qubits (read-only).
- class pauliengine._core.PauliOrbitSumSymbolic(*args, **kwargs)¶
Bases:
objectA weighted sum of Pauli orbits with symbolic coefficients, sum_i coeffs[i] * data[i], on a fixed number of qubits.
- __add__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic¶
- __add__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliOrbitSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliOrbitSumSymbolic
- __add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliOrbitSumSymbolic
- __add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __add__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__add__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliOrbitSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliOrbitSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliOrbitSumSymbolic
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Sum with another operator; a PauliStringSum unless both are in the same family.
__add__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__add__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Sum with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- __contains__(self, orbit: pauliengine._core.PauliOrbit) bool¶
True if orbit occurs in the sum with a non-zero coefficient.
- __eq__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) bool¶
- __eq__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) bool
- __eq__(self, other: object | None) object
Overloaded function.
__eq__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> bool
True if both have the same summands with equal coefficients.
__eq__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> bool
True if both have the same summands with equal coefficients.
__eq__(self, other: object | None) -> object
NotImplemented for objects of other types.
- __init__(self, n_qubits: int) None¶
The empty sum on n_qubits qubits. Raises ValueError unless 0 <= n_qubits <= PauliOrbit.max_qubits.
- __len__(self) int¶
Number of terms.
- __mul__(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliOrbitSumSymbolic¶
- __mul__(self, scale: int) pauliengine._core.PauliOrbitSumSymbolic
- __mul__(self, scale: float) pauliengine._core.PauliOrbitSumSymbolic
- __mul__(self, scale: complex) pauliengine._core.PauliOrbitSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliOrbitSumSymbolic
- __mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliOrbitSumSymbolic
- __mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __mul__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
- __mul__(self, scale: pauliengine._core.Expression) pauliengine._core.PauliOrbitSumSymbolic
Overloaded function.
__mul__(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliOrbitSumSymbolic
Product self * other = sum_ij a_i b_j B_i B_j.
__mul__(self, scale: int) -> pauliengine._core.PauliOrbitSumSymbolic
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: float) -> pauliengine._core.PauliOrbitSumSymbolic
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, scale: complex) -> pauliengine._core.PauliOrbitSumSymbolic
The sum with every coefficient scaled by an int, float or complex number; scaling by 0 gives the empty sum.
__mul__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliOrbitSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliOrbitSumSymbolic
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Product with another operator; a PauliStringSum unless both are in the same family.
__mul__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__mul__(self, scale: pauliengine._core.Expression) -> pauliengine._core.PauliOrbitSumSymbolic
Every coefficient multiplied by a symbolic expression; the result is symbolic.
- __sub__(self, arg: pauliengine._core.PauliStringComplex, /) pauliengine._core.PauliStringSumSymbolic¶
- __sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbit, /) pauliengine._core.PauliOrbitSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) pauliengine._core.PauliOrbitSumSymbolic
- __sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) pauliengine._core.PauliOrbitSumSymbolic
- __sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) object
- __sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) object
- __sub__(self, arg: pauliengine._core.unweighted_pauliString, /) pauliengine._core.PauliStringSumSymbolic
- __sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
__sub__(self, arg: pauliengine._core.PauliStringComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliStringSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumComplex, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliCycleSumSymbolic, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbit, /) -> pauliengine._core.PauliOrbitSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumComplex, /) -> pauliengine._core.PauliOrbitSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.PauliOrbitSumSymbolic, /) -> pauliengine._core.PauliOrbitSumSymbolic
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumComplex, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.SparsePauliStringSumSymbolic, /) -> object
Difference with another operator; a PauliStringSum unless both are in the same family.
__sub__(self, arg: pauliengine._core.unweighted_pauliString, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
__sub__(self, arg: pauliengine._core.unweighted_PauliStringSum, /) -> pauliengine._core.PauliStringSumSymbolic
Difference with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- add(self, orbit: pauliengine._core.PauliOrbit, coeff: pauliengine._core.Expression) None¶
- add(self, orbit: pauliengine._core.PauliOrbit, coeff: str) None
- add(self, orbit: pauliengine._core.PauliOrbit, coeff: complex) None
Overloaded function.
add(self, orbit: pauliengine._core.PauliOrbit, coeff: pauliengine._core.Expression) -> None
Add coeff * orbit in place, merging into an existing term with the same label. Raises ValueError if orbit.n_qubits differs.
add(self, orbit: pauliengine._core.PauliOrbit, coeff: str) -> None
Add coeff * orbit in place; the coefficient is parsed like ‘a*b’.
add(self, orbit: pauliengine._core.PauliOrbit, coeff: complex) -> None
Add coeff * orbit in place, with a numeric coefficient.
- commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.PauliOrbitSumSymbolic¶
- commutator(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbit) pauliengine._core.PauliOrbitSumSymbolic
- commutator(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.PauliOrbitSumSymbolic
- commutator(self, other: pauliengine._core.SparsePauliStringComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) object
- commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) object
- commutator(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.PauliStringSumSymbolic
- commutator(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.PauliStringSumSymbolic
Overloaded function.
commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.PauliOrbitSumSymbolic
Commutator [self, other] = sum_ij a_i b_j [B_i, B_j].
commutator(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.PauliStringSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.PauliOrbitSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.PauliOrbitSumSymbolic
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumComplex) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> object
Commutator [self, other] with another operator; a PauliStringSum unless both are in the same family.
commutator(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
commutator(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.PauliStringSumSymbolic
Commutator with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- contains(self, orbit: pauliengine._core.PauliOrbit) pauliengine._core.Expression¶
Coefficient of orbit in the sum (0 if absent).
- diff(self, symbol: str) pauliengine._core.PauliOrbitSumSymbolic¶
Derivative of every coefficient with respect to the named symbol; terms that become zero are dropped.
- inner_product(self, other: pauliengine._core.PauliStringComplex) pauliengine._core.Expression¶
- inner_product(self, other: pauliengine._core.PauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbit) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_pauliString) pauliengine._core.Expression
- inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) pauliengine._core.Expression
Overloaded function.
inner_product(self, other: pauliengine._core.PauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliCycleSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbit) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.PauliOrbitSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumComplex) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.SparsePauliStringSumSymbolic) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product Tr(self^dagger other) / 2**n, so Pauli strings are orthonormal (arXiv:2604.16701, Cor. 1 / Lemma 1). Conjugate-linear in self; multiply by 2**n for the unnormalized trace on n qubits. Orbits are never expanded.
inner_product(self, other: pauliengine._core.unweighted_pauliString) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
inner_product(self, other: pauliengine._core.unweighted_PauliStringSum) -> pauliengine._core.Expression
Normalized Hilbert-Schmidt inner product with an unweighted operator, which counts with coefficient 1.0 * i**phase.
- prune_zeros(self) None¶
Drop terms whose coefficient is zero, in place.
- subs(self, values: collections.abc.Mapping[str, complex | str | pauliengine._core.Expression]) pauliengine._core.PauliOrbitSumSymbolic¶
Substitute values for symbols (see PauliStringSymbolic.subs); terms that become zero are dropped.
- targeted_commutator(self, other: pauliengine._core.PauliOrbitSumSymbolic, target: pauliengine._core.PauliOrbit) pauliengine._core.Expression¶
Coefficient of target in [self, other], without building the full commutator.
- to_pauli_string_sum(self) pauliengine._core.PauliStringSumSymbolic¶
The sum expanded into a PauliStringSum.
- __hash__ = None¶
- property coeffs¶
The list of coefficients, parallel to data.
- property data¶
The orbits; each label occurs at most once.
- property n_qubits¶
Number of qubits (read-only).
Symbolic coefficients¶
A text coefficient such as "2*a*b + 3" becomes an Expression, a polynomial in
named symbols. dagger() and conjugate() turn a symbol a into
conjugate(a); the functions below declare symbols as real (unchanged under
conjugation) or complex (a and conjugate(a) independent for diff).
- class pauliengine.Expression(*args, **kwargs)¶
Bases:
objectA symbolic coefficient: a polynomial in named symbols with complex coefficients, kept in canonical form (so equal polynomials compare equal and a - a is 0). conjugate() turns a symbol a into conjugate(a) unless it was declared real with set_symbol_real().
- __add__(self, arg: pauliengine._core.Expression, /) pauliengine._core.Expression¶
- __add__(self, arg: complex, /) pauliengine._core.Expression
- __eq__(self, arg: pauliengine._core.Expression, /) bool¶
- __eq__(self, arg: complex, /) bool
Overloaded function.
__eq__(self, arg: pauliengine._core.Expression, /) -> bool
Equal polynomials.
__eq__(self, arg: complex, /) -> bool
Equal to the number.
- __hash__(self) int¶
- __init__(self, text: str) None¶
- __init__(self, value: complex) None
Overloaded function.
__init__(self, text: str) -> None
Parse a polynomial such as ‘a*b + 2’, ‘2a - b**2/4’ or ‘(1 + 2*I)*c’. I is the imaginary unit; pi and E are numbers. Division is only allowed by numbers. Raises ValueError.
__init__(self, value: complex) -> None
A numeric expression.
- __mul__(self, arg: pauliengine._core.Expression, /) pauliengine._core.Expression¶
- __mul__(self, arg: complex, /) pauliengine._core.Expression
- __sub__(self, arg: pauliengine._core.Expression, /) pauliengine._core.Expression¶
- __sub__(self, arg: complex, /) pauliengine._core.Expression
- conjugate(self) pauliengine._core.Expression¶
Complex conjugate: every symbol a becomes conjugate(a), except symbols declared real.
- diff(self, symbol: str) pauliengine._core.Expression¶
Derivative with respect to the named symbol; conjugate(symbol) counts as the same variable unless the symbol was declared complex.
- free_symbols(self) list[str]¶
Names of the symbols that occur, sorted.
- n_terms(self) int¶
Number of monomials.
- subs(self, values: collections.abc.Mapping[str, complex | str | pauliengine._core.Expression]) pauliengine._core.Expression¶
Substitute values for symbols, given as {name: value}. A value is a number, an Expression or a polynomial as text such as ‘b + 2*c’; all symbols are replaced at once, so {‘a’: ‘b’, ‘b’: ‘a’} swaps them. Symbols without a value stay.
- to_complex(self) complex¶
The value; raises RuntimeError if symbols are left.
- property is_number¶
True if no symbols are left.
- property is_zero¶
True for the zero polynomial.
- pauliengine.set_symbol_real(name: str, is_real: bool = True) None¶
Declare a symbol real (with False: undeclared again). By default conjugate() and dagger() turn a symbol a into conjugate(a), and subs({‘a’: v}) puts conj(v) in for it, so the result is right for real and complex values. A real symbol stays a, so a Hermitian sum with real symbols equals its dagger before anything is substituted.
- pauliengine.set_symbol_complex(name: str, is_complex: bool = True) None¶
Declare a symbol complex (with False: real). It is conjugated like an undeclared symbol, but diff treats a and conjugate(a) as independent variables (Wirtinger derivatives); for an undeclared symbol diff(‘a’) also differentiates conjugate(a).
- pauliengine.is_symbol_real(name: str) bool¶
True if the symbol was declared real.
- pauliengine.is_symbol_complex(name: str) bool¶
True if the symbol was declared complex.
Functions¶
Conversions from other formats are static methods of the factory:
PauliStringSum.from_matrix
(Pauli decomposition of a matrix),
PauliStringSum.from_openfermion
and PauliString.from_hash.
- pauliengine.inner_product(a, b)[source]¶
Normalized Hilbert-Schmidt inner product Tr(a^dagger b) / 2**n.
Works for any two of PauliString, PauliStringSum, PauliCycle, PauliCycleSum, PauliOrbit and PauliOrbitSum; Pauli strings are orthonormal. Conjugate-linear in
a. Multiply by 2**n for the unnormalized trace on n qubits.
- pauliengine.set_sparse_threshold(min_qubits=None, max_density=None)[source]¶
Change when operators are stored sparse.
The factories
PauliStringandPauliStringSumbuild a sparse operator when it spans at leastmin_qubitsqubits and its strings have a mean weight of at mostmax_densitytimes the span. Products and commutators of sparse operators stay sparse while the result fits this rule and are formed with bit vectors otherwise; a sum of a sparse operand with an operator with bit vectors that misses the rule is formed with bit vectors as well, so chains of operations do not switch back and forth.- Parameters:
min_qubits (float | None) – Smallest span (highest qubit index + 1) for a sparse operator.
0makes every operator within the density limit sparse,float("inf")turns sparse operators off. Default 256.max_density (float | None) – Largest mean weight of the strings, as a fraction of the span. Default 1/256, so strings of weight 2 are sparse from 512 qubits on and strings of weight 4 from 1024.
- Return type:
None