tqecd.pauli.PauliString#

class PauliString(pauli_by_qubit: dict[int, Literal['I', 'X', 'Y', 'Z']])[source]#

A mapping from qubits to Pauli operators that represent a Pauli string.

Invariant:

This class never stores identity Pauli terms. Any missing Pauli term is considered to be an identity. As such, it is illegal to initialise this class with an identity term.

__init__(pauli_by_qubit: dict[int, Literal['I', 'X', 'Y', 'Z']]) None[source]#

Methods

__init__(pauli_by_qubit)

after(tableau, targets)

anticommutes(other)

Check if this Pauli string anticommutes with another Pauli string.

collapse_by(collapse_operators)

Collapse the provided Pauli string by the provided operators.

commutes(other)

Check if this Pauli string commutes with another Pauli string.

contains(other)

from_stim_pauli_string(stim_pauli_string)

Convert a stim.PauliString to a PauliString instance, ignoring the sign.

overlaps(other)

to_stim_pauli_string(length)

Convert a PauliString to a stim.PauliString instance.

Attributes

non_trivial_pauli_count

qubit

qubits