loom.interpreter.detector

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.interpreter.detector.Detector(*args, **kwargs)[source]

Bases: object

A detector is the parity of multiple syndromes. This dataclass does not store the actual value of a detector but instead the required information on how to calculate it given the output of a quantum circuit.

Parameters:

syndromes (tuple[Syndrome, ...]) – Syndromes that this detector corresponds to, in temporal order of measurement. NOTE: “Please ensure this order for proper functioning of the detector”

dumps()[source]

Return the detector as a JSON string. This string does not contain the complete Syndrome objects but only their UUIDs to not store redundant information.

Return type:

str

labels: dict[str, str | tuple[int, ...] | int] = FieldInfo(annotation=dict[str, Union[str, tuple[int, ...], int]], required=False, default_factory=dict)
property measurements: tuple[tuple[str, int] | Literal[1, 0], ...]

Returns the measurements of the constituent syndromes. The corrections must be used in a detector definition only once.

Returns:

The detector measurements

Return type:

tuple[Cbit, …]

rounds()[source]

Returns the rounds of the constituent syndromes

Returns:

The detector rounds

Return type:

tuple[int]

stabilizer()[source]

Returns the UUIDs of the stabilizer(s) of the constituent syndromes

Returns:

The UUIDs of the stabilizer(s) of the constituent syndromes.

Return type:

tuple[str]

syndromes: tuple[Syndrome, ...]