qrunch.quantum.operators.pauli.operator_base
Base class for all Pauli operators, which define internal logic and enables simplification of Pauli expressions.
Classes
Base class for a Pauli operator. |
|
Represents the collection of Pauli operators \(X\), \(Y\), \(Z\) and \(I\). |
- class PauliOperator
Bases:
Expression[PauliOperators],Indexable[PauliOperators],ABCBase 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 usingwith_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:
- class PauliOperators
Bases:
OperatorCollectionRepresents the collection of Pauli operators \(X\), \(Y\), \(Z\) and \(I\).