loom.eka.pauli_operator

Copyright (c) Entropica Labs Pte Ltd 2025.

Use, distribution and reproduction of this program in its source or compiled form is prohibited without the express written consent of Entropica Labs Pte Ltd.

class loom.eka.pauli_operator.PauliOperator(*args, **kwargs)[source]

Bases: object

A 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:

SignedPauliOp

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:

PauliOperator

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.