loom.cliffordsim.operations.classical_operation
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.cliffordsim.operations.classical_operation.ClassicalAND(reg_name, input_bit_order=<factory>, input_bit_ids=<factory>, output_reg_name=None, write_bit_order=None, write_bit_id=None)[source]
Bases:
ClassicalTwoBitOperationEvaluates a classical AND operation from 2 input bits and writes the output onto a referenced bit, known as the write bit.
-
name:
str= 'ClassicalAND'
-
name:
- class loom.cliffordsim.operations.classical_operation.ClassicalNOT(reg_name, bit_order=None, bit_id=None)[source]
Bases:
ClassicalOperationApply a classical NOT operation on a bit.
- Parameters:
reg_name (str) – The name of the classical register whose bit to apply the Operation to.
bit_order (int) – The numerical order of the bit within the classical register.
bit_id (str) – The ID of the bit within the classical register.
-
bit_id:
str= None
-
bit_order:
int= None
-
name:
str= 'ClassicalNOT'
-
reg_name:
str
- class loom.cliffordsim.operations.classical_operation.ClassicalOR(reg_name, input_bit_order=<factory>, input_bit_ids=<factory>, output_reg_name=None, write_bit_order=None, write_bit_id=None)[source]
Bases:
ClassicalTwoBitOperationEvaluates a classical OR operation from 2 input bits and writes the output onto a referenced bit, known as the write bit.
-
name:
str= 'ClassicalOR'
-
name:
- class loom.cliffordsim.operations.classical_operation.ClassicalOperation[source]
Bases:
OperationOperations of this type manipulate classical bits within the Engine during runtime.
-
operation_type:
Enum= 'Classical'
- 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.
-
operation_type:
- class loom.cliffordsim.operations.classical_operation.ClassicalTwoBitOperation(reg_name, input_bit_order=<factory>, input_bit_ids=<factory>, output_reg_name=None, write_bit_order=None, write_bit_id=None)[source]
Bases:
ClassicalOperationClassical 2 Bit Operations that require 2 bits as input and 1 bit as output.
- Parameters:
reg_name (str) – The name of the classical register whose bits is used as input to evaluate the 2-bit operation.
input_bit_order (list[int]) – The order of the bits within the classical register that will be used as inputs for the 2-bit operation.
input_bit_ids (list[str]) – The bit IDs of the bits within the classical reigster that will be used as inputs for the 2-bit operation.
output_reg_name (Optional[str]) – The name of the classical register where the output of the 2-bit operation will be written to. If not provided, this is equal to the register referred to by reg_name.
write_bit_order (int) – The order of the bit within the classical register, specified by output_reg_name, where the output of the 2-bit operation will be written to.
write_bit_ids (str) – The bit ID of the bit within the classical register, specified by output_reg_name, where the output of the 2-bit operation will be written to.
-
input_bit_ids:
list[str]
-
input_bit_order:
list[int]
-
output_reg_name:
Optional[str] = None
-
reg_name:
str
-
write_bit_id:
str= None
-
write_bit_order:
int= None