loom_steane_code.code_factory.steane_code
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_steane_code.code_factory.steane_code.SteaneCode(*args, **kwargs)[source]
Bases:
BlockA sub-class of
Blockthat represents a Steane code block.- classmethod create(lattice, unique_label=None, position=(0, 0), skip_validation=False)[source]
Create Steane Code Block object. The Steane Code is a [[7, 1, 3]] quantum error-correcting CSS code. There are 6 stabilizers, three of X type and three of Z type all of support size 4. We implement a naive syndrome extraction scheme, where measure all X stabilizers first and all the Z stabilizers later. We choose to embed the code in a 2D square lattice, where the logical operators are defined on the three lowest data qubits.
- Parameters:
lattice (Lattice) – Lattice on which the block is defined. The qubit indices depend on the type of lattice.
unique_label (str, optional) – Label for the block. It must be unique among all blocks in the initial CRD. If no label is provided, a unique label is generated automatically using the uuid module.
position (tuple[int, ...], optional) – Position of the top left corner of the block on the lattice, by default (0, 0).
skip_validation (bool, optional) – Skip validation of the block object, by default False.
- Returns:
Block object for the Steane Code.
- Return type:
- static generate_syndrome_extraction_circuits(pauli)[source]
Generate syndrome extraction circuit for a stabilizers from the Steane Code. The prescription followed here is to first measure all stabilizers of a given type simultaneously in four layers (arbitrarily chosen to be entangling in the data qubits with the ancilla in a clockwise order). We choose X stabilizers to be measured first, thus we need to add four idling steps at the end, and four at the beginning for the Z stabilizers. The ancilla is then measured and reset.
- Parameters:
pauli (str) – Pauli operator for which the syndrome extraction circuit is generated.
- Returns:
Syndrome extraction circuit for the given Pauli operator.
- Return type:
- shift(position, new_label=None)[source]
Return a copy of the Block where all qubit coordinates are shifted by a given position.
- Parameters:
position (tuple[int, ...]) – Vector by which the block should be shifted
new_label (str | None, optional) – New label for the block. If None, the same label is used.
- Returns:
A new Block with the shifted qubit coordinates.
- Return type:
-
stabilizer_to_circuit:
dict[str,str] = FieldInfo(annotation=dict[str, str], required=False, default_factory=dict, validate_default=True)
- property stabilizers_labels: dict[str, dict[str, tuple[int, ...]]]
Builds a dictionary associating stabilizers, via their uuid, with a set of labels defined through a dictionary. Inside Block, this is generically populated with the space coordinates of the stabilizer check, corresponding to the ancilla which measures each stabilizer.
This functionality can be leveraged to later provide these labels to Syndromes and Detectors associated with a given Stabilizer.
- Returns:
Dictionary associating stabilizer uuids with their labels.
- Return type:
dict[str, dict[str, tuple[int, …]]]
-
syndrome_circuits:
tuple[SyndromeCircuit,...] = FieldInfo(annotation=tuple[SyndromeCircuit, ...], required=False, default_factory=tuple, validate_default=True)
-
unique_label:
str= FieldInfo(annotation=str, required=False, default_factory=<lambda>)
-
uuid:
str= FieldInfo(annotation=str, required=False, default_factory=<lambda>, validate_default=True)