loom.cliffordsim.operations.measurement_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.measurement_operation.Measurement(target_qubit, label=<factory>, reg_name=None, bit_order=None, bit_id=None, basis='Z', bias=0.5)[source]
Bases:
MeasurementOperationCreates a measurement operation for a single qubit. By default, the output of the measurement is saved to the DataStore. If the user wants to write the output onto the classical register, the classical register needs to be specified with reg_name and (bit_order or bit_id).
- Parameters:
label (str) – The ID of the Measurement Operation. Automatically generated by Default.
reg_name (Optional[str]) – The name of the classical register to write the measurement output to.
bit_order (Optional[int]) – The ordering of the bit within the classical register to write the measurement output to.
bit_id (Optional[str]) – The bit ID of the bit within the classical register to write the measurement output to.
basis (str) – The basis of the measurement. Default is Z.
bias (float) – The bias of the measurement. Default is 0.5.
-
basis:
str= 'Z'
-
bias:
float= 0.5
-
bit_id:
Optional[str] = None
-
bit_order:
Optional[int] = None
-
label:
str
-
name:
str= 'Measurement'
-
reg_name:
Optional[str] = None
- class loom.cliffordsim.operations.measurement_operation.MeasurementOperation(target_qubit)[source]
Bases:
OperationOperations of this type perform measurements on qubits within the Engine during runtime.
-
operation_type:
str= 'Measurement'
-
target_qubit:
int
- 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.measurement_operation.Reset(target_qubit, label=<factory>, state='0')[source]
Bases:
MeasurementOperationResets a qubit to a specific cardinal state. By default, the qubit is reset to the |0> state.
- Parameters:
state (str) – The state to which the qubit is reset. The state can be one of the following: 0, 1, +, -, +i, -i. Default is 0.
-
label:
str
-
name:
str= 'Reset'
-
state:
str= '0'