loom.validator.check_code_stabilizers
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.validator.check_code_stabilizers.CodeStabilizerCheck(*args, **kwargs)[source]
Bases:
AbstractValidityCheckDataclass to store the results of the Code Stabilizer check.
- Parameters:
output (CodeStabilizerCheckOutput) – An object containing the output of the check.
Properties
----------
message (str) – A message indicating the result of the check. It will be empty if the check is valid, otherwise it will contain a message describing the issue.
valid (bool) – True if the check is valid (i.e., no missing stabilizers and no stabilizers with incorrect parity), False otherwise.
- property message: str
A message indicating the result of the check. It will be empty if the check is valid, otherwise it will contain a message describing the issue.
-
output:
CodeStabilizerCheckOutput
- class loom.validator.check_code_stabilizers.CodeStabilizerCheckOutput(*args, **kwargs)[source]
Bases:
objectDataclass to store the output of the Code Stabilizer check.
- Parameters:
missing_stabilizers (tuple[Stabilizer, ...]) – A tuple containing the code stabilizers that were not found in the output.
stabilizers_with_incorrect_parity (tuple[Stabilizer, ...]) – A tuple containing the code stabilizers that were found in the output but have incorrect parity.
-
missing_stabilizers:
tuple[Stabilizer,...]
-
stabilizers_with_incorrect_parity:
tuple[Stabilizer,...]
- loom.validator.check_code_stabilizers.check_code_stabilizers_output(base_cliffordsim_operations, input_block, output_block, output_stabilizers_parity, output_stabilizers_with_any_value, seed)[source]
Checks whether the correct code stabilizers are found in the output.
- Parameters:
base_cliffordsim_operations (tuple[
loom.cliffordsim.operations.base_operation.Operation, …]) – The cliffordsim operations that represent the circuit to be checked.input_block (Block) – The Block object that represents the input code.
output_block (Block) – The Block object that represents the output code.
output_stabilizers_parity (list[tuple[Stabilizer, tuple[str | int, ...]]]) – A list of stabilizers that are expected to be in the output with a specific parity. The parity is represented as a tuple of strings and integers, where the strings are the labels of the classical bits where the result is stored at runtime, and the integers are the constant parity changes. The final parity is calculated by XORing the values of all of these bits.
output_stabilizers_with_any_value (list[Stabilizer]) – The list of stabilizers that are expected to be in the output, but with any value.
seed (int | None) – The seed for the cliffordsim engine.
- Returns:
The result of the Code Stabilizer check.
- Return type: