qib.operator.pauli_operator.PauliOperator¶
- class qib.operator.pauli_operator.PauliOperator(pstrings: Sequence[WeightedPauliString] | None = None)[source]¶
Bases:
AbstractOperatorAn operator consisting of Pauli strings.
Methods
Add a weighted Pauli string.
Generate the (sparse) matrix representation of the operator.
List of fields the Pauli operator acts on.
Whether the operator is Hermitian.
Whether the operator is unitary.
Remove the redundant Pauli strings with weight zero.
Set a field which the Pauli operator acts on (such that it can be used like a Hamiltonian).
Attributes
Number of qubits, i.e., length of each Pauli string, including identities.
- add_pauli_string(ps: WeightedPauliString)[source]¶
Add a weighted Pauli string. If the string already exists, only its weight is updated.
- property num_qubits¶
Number of qubits, i.e., length of each Pauli string, including identities.