PauliSum
- class braket.quantum_information.pauli_sum.PauliSum(terms=())[source]
Bases:
objectA weighted sum of Pauli strings.
- Parameters:
terms (
Iterable[tuple[Number,str|PauliString]])
Initializes a
PauliSum.- Parameters:
terms (
Iterable[tuple[Number,str|PauliString]]) – Pairs of coefficient and Pauli string.
- property all_terms_commute: bool
Whether all terms in the sum commute with each other.
- Type:
bool
- classmethod from_list(terms)[source]
Builds a
PauliSumfrom a list of weighted Pauli strings.- Parameters:
terms (
Iterable[tuple[Number,str|PauliString]])- Return type:
- property terms: tuple[tuple[Number, PauliString], ...]
The weighted Pauli terms.
- Type:
tuple[tuple[numbers.Number, PauliString], …]
- property qubit_count: int
The number of qubits in the largest Pauli string term.
- Type:
int
- to_list()[source]
Returns a list representation of the weighted Pauli strings.
- Return type:
list[tuple[Number,str]]
- commutes_with(other)[source]
Returns whether all terms commute with
other.- Parameters:
other (
PauliSum|PauliString|str)- Return type:
bool