qrunch.quantum.operators.pauli.operator_base

Base class for all Pauli operators, which define internal logic and enables simplification of Pauli expressions.

Classes

PauliOperator

Base class for a Pauli operator.

PauliOperators

Represents the collection of Pauli operators \(X\), \(Y\), \(Z\) and \(I\).

class PauliOperator

Bases: Expression[PauliOperators], Indexable[PauliOperators], ABC

Base class for a Pauli operator.

All concrete Pauli operators (\(X\), \(Y\), \(Z\) and \(I\)) inherits from this.

__init__(qubit: AbstractIndex | int) None

Initialize Pauli operator that operates on the specified qubit.

The index can be a concrete integer or an AbstractIndex. When an abstract index is used it can be set using with_indices(), returning a new instance of the operator with the index set to the concrete value.

Parameters:

qubit (AbstractIndex | int) – The qubit to operate on.

Return type:

None

get_indices() tuple[AbstractIndex | int]

Get index of the operator (abstract or concrete).

Return type:

tuple[AbstractIndex | int]

property qubit: AbstractIndex | int

The qubit the operator acts on.

with_indices(index_value_pairs: IndexValuePairs) PauliOperator

Create a new copy of the operator with the AbstractIndex set to the given value.

Parameters:

index_value_pairs (IndexValuePairs) – Map of abstract indices to concrete values.

Return type:

PauliOperator

class PauliOperators

Bases: OperatorCollection

Represents the collection of Pauli operators \(X\), \(Y\), \(Z\) and \(I\).