loom.cliffordsim.operations.controlled_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.controlled_operation.ControlledOperation(app_operation, reg_name, bit_order=None, bit_id=None)[source]

Bases: Operation

A decorator of the Operation class that turns any operation into a classically controlled operation. The Operation will be conditioned on the value of a single bit.

NOTE: The Operation classes decorated by the ControlledOperation class can only be controlled by one bit.

Parameters:
  • app_operation (loom.cliffordsim.operations.base_operation.Operation) – The Operation that will be Classically Controlled.

  • reg_name (str) – The name of the Classical Register where the bit that classically controls app_operation will be located.

  • bit_order (Optional[int]) – The ordering of the bit within the classical register that app_operation will be conditioned on. Either bit_order or bit_id needs to be specified. If both or none are specified, an error is raised.

  • bit_id (Optional[str]) – The bit ID of the bit within the classical register that app_operation will be conditioned on. Either bit_order or bit_id needs to be specified. If both or none are specified, an error is raised.

app_operation: Operation
bit_id: Optional[str] = None
bit_order: Optional[int] = None
name: str = 'ControlledOperation'
operation_type: Enum = 'CControl'
reg_name: str
loom.cliffordsim.operations.controlled_operation.has_ccontrol(cls)[source]

This function acts as a decorator that adds the with_ccontrol method to the input Operation class.