loom.eka.pauli_operator
Copyright 2024 Entropica Labs Pte Ltd
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class loom.eka.pauli_operator.PauliOperator(*args, **kwargs)[source]
Bases:
objectA PauliOperator is defined by a pauli string, and a set of data qubits.
- Parameters:
pauli (str) – The Pauli string that defines this operator.
data_qubits (tuple[tuple[int, ...], ...]) – Qubits involved in the operator. They are referred to by their coordinates in the lattice.
uuid (str) – Unique identifier of the operator. This is automatically set to a random UUID.
- as_signed_pauli_op(all_qubits)[source]
Get the SignedPauliOp representation of the PauliOperator.
- Parameters:
all_qubits (tuple[tuple[int, ...], ...]) – All qubits coordinates in the system.
- Returns:
The SignedPauliOp representation of the PauliOperator.
- Return type:
- Raises:
ValueError – If the number of qubits in the system is less than the number of qubits in the operator.
- commutes_with(other_operator)[source]
Check if the PauliOperator commutes with another PauliOperator.
- Parameters:
other_operator (PauliOperator) – The other PauliOperator to check commutation with.
- Returns:
True if the two objects commute, False otherwise.
- Return type:
bool
-
data_qubits:
tuple[tuple[int,...],...]
- static from_signed_pauli_op(signed_pauli_op, index_to_qubit_map)[source]
Create a PauliOperator from a SignedPauliOp.
- Parameters:
signed_pauli_op (SignedPauliOp) – The SignedPauliOp to convert to a PauliOperator.
index_to_qubit_map (dict[int, tuple[int, ...]]) – A dictionary mapping the indices of the SignedPauliOp to the qubit coordinates in the lattice.
- Returns:
The PauliOperator representation of the SignedPauliOp.
- Return type:
-
pauli:
str
- property pauli_type: str
‘X’, ‘Y’, or ‘Z’.
- Type:
Type of the Pauli operator
-
uuid:
str= FieldInfo(annotation=str, required=False, default_factory=<lambda>, validate_default=True)
- property weight: int
Number of qubits involved in the operator.