loom.validator.check_code_stabilizers

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.validator.check_code_stabilizers.CodeStabilizerCheck(*args, **kwargs)[source]

Bases: AbstractValidityCheck

Dataclass 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: object

Dataclass 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:

CodeStabilizerCheck