loom.cliffordsim.operations.datamanipulation_operation

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.cliffordsim.operations.datamanipulation_operation.CreateClassicalRegister(reg_name, no_of_bits=1, bit_ids=None)[source]

Bases: DataManipulationOperation

An operation that creates a Classical Register within the Engine that can be accessed at runtime by classical operations. Since there can be multiple classical registers, the registers will be associated by their reg_name, and their bits by their respective bit IDs or bit ordering as provided by the user.

If trying to initialize a classical register with bit IDs, the number of bit IDs must be equal to the number of bits in the register.

Example of valid Classical Register: CreateClassicalRegister(reg_name=”testreg”, no_of_bits=3, bit_ids=[“bit_id_1”, “bit_id_2”, “bit_id_3”])

Parameters:
  • reg_name (str) – The name of the classical register. This name will be used by cliffordsim to identify the classical register being referred to by the user.

  • no_of_bits (int) – The number of bits to initialize the register with. Default is 1.

  • bit_ids (list[str]) – The bit IDs of all the bits in the register. Example input: [“bit_id_1”, “bit_id_2”, “bit_id_3”]. The number of bit IDs provided must be equal to the number of bits in the classical register. If no bit IDs are provided, the classical register will randomly generate the IDs upon initialization.

bit_ids: list[str] = None
name: str = 'CreateClassicalRegister'
no_of_bits: int = 1
reg_name: str
class loom.cliffordsim.operations.datamanipulation_operation.CreatePauliFrame(pauli_frame)[source]

Bases: DataManipulationOperation

An Operation that creates a Pauli Frame within the Engine during runtime. The Pauli Frame created will be associated with the name provided by the user, and can be accessed at runtime by other operations. Since there can be multiple Pauli Frames, the frames will be associated by their names.

name: str = 'CreatePauliFrame'
pauli_frame: PauliFrame
class loom.cliffordsim.operations.datamanipulation_operation.DataManipulationOperation[source]

Bases: Operation

Operations of this type manipulate data within the Engine during runtime.

operation_type: str = 'DataManipulation'
with_ccontrol(reg_name, bit_order=None, bit_id=None)

This method returns a ControlledOperation wrapped version of the Operation class. The wrapped Operation class is classically controlled by the bit from the classical register specified by reg_name in bit_order or by bit_id.

NOTE: ControlledOperation(s) can only be conditioned on one classical bit.

class loom.cliffordsim.operations.datamanipulation_operation.RecordClassicalRegister(reg_name)[source]

Bases: DataManipulationOperation

Records the current state of the Classical Register into the DataStore. The state can then be accessed at the end of the run from the DataStore.

Parameters:

reg_name (str) – The name of the Classical Register to record.

name: str = 'RecordClassicalRegister'
reg_name: str
class loom.cliffordsim.operations.datamanipulation_operation.RecordPauliFrame(pauli_frame)[source]

Bases: DataManipulationOperation

Records the current state of the Pauli Frame into the DataStore. The state can then be accessed at the end of the run from the DataStore. The Pauli Frame to be recorded will be identified by its name.

name: str = 'RecordPauliFrame'
pauli_frame: PauliFrame
class loom.cliffordsim.operations.datamanipulation_operation.UpdateTableau(tableau, validate=True)[source]

Bases: DataManipulationOperation

An Operation that updates the state of the Tableau in the Engine during runtime. Note that the tableau must be a numpy array with bits, 0s and 1s, for every element.

Parameters:
  • tableau (numpy.ndarray) – The state of the Tableau to be updated to.

  • validate (bool) – The tableau will be validated at runtime. The tableau provided must be a valid stabilizer tableau. The default is True.

name: str = 'UpdateTableau'
tableau: ndarray
validate: bool = True