cirq.PauliSum

class cirq.PauliSum(linear_dict: Optional[cirq.value.linear_dict.LinearDict[FrozenSet[Tuple[cirq.ops.raw_types.Qid, cirq.ops.pauli_gates.Pauli]]]] = None)[source]

Represents operator defined by linear combination of PauliStrings.

Since PauliStrings store their own coefficients, this class
does not implement the LinearDict interface. Instead, you can
add and subtract terms and then iterate over the resulting
(simplified) expression.
Under the hood, this class is backed by a LinearDict with coefficient-less
PauliStrings as keys. PauliStrings are reconstructed on-the-fly during
iteration.
__init__(linear_dict: Optional[cirq.value.linear_dict.LinearDict[FrozenSet[Tuple[cirq.ops.raw_types.Qid, cirq.ops.pauli_gates.Pauli]]]] = None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

copy()

expectation_from_density_matrix(state, …)

Evaluate the expectation of this PauliSum given a density matrix.

expectation_from_wavefunction(state, …[, …])

Evaluate the expectation of this PauliSum given a wavefunction.

from_pauli_strings(terms)

wrap(val)

Attributes

qubits