loom_rotated_surface_code.applicator.shrink
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.
- loom_rotated_surface_code.applicator.shrink.shrink(interpretation_step, operation, same_timeslice, debug_mode)[source]
Shrink a Block in the specified direction.
The algorithm is the following:
A.) DATA QUBITS
A.1) Find data qubits which are measured in the shrink
B.) CIRCUIT
B.1) Create classical channels for all data qubit measurements
B.2) Create a measurement circuit for every measured data qubit
B.3) Append the measurement circuits to the InterpretationStep circuit. If needed, apply a basis change
C.) STABILIZERS
C.1) Find stabilizers which are completely removed
C.2) Find stabilizers which have to be reduced in weight
C.3) Create new stabilizers with reduced weight
C.4) Update
stabilizer_evolutionandstabilizer_updatesfor the stabilizers which have been reduced in weightC.5) Combine the stabilizers to get a new set of stabilizers
C.6) Create syndromes for fully measured stabilizers
C.7) Create detectors for fully measured stabilizers
D.) LOGICAL OPERATORS
D.1) Find logical operators which do not have to be modified
E.) NEW BLOCK AND NEW INTERPRETATION STEP
E.1) Update the stabilizer to circuit mapping
E.2) Create the new block
E.3) Update the block history
- Parameters:
interpretation_step (InterpretationStep) – Interpretation step containing the block to shrink.
operation (Shrink) – Shrink operation description.
same_timeslice (bool) – Flag indicating whether the operation is part of the same timestep as the previous operation.
debug_mode (bool) – Flag indicating whether the interpretation should be done in debug mode. Activating debug mode will enable commutation validation for Block
- Returns:
Interpretation step after the shrink operation.
- Return type:
- loom_rotated_surface_code.applicator.shrink.shrink_consistency_checks(interpretation_step, operation)[source]
Check if the Shrink operation is valid for the given state of blocks
- Parameters:
interpretation_step (InterpretationStep) – Interpretation step containing the block to shrink.
operation (Shrink) – Shrink operation description.
- Returns:
The block to be shrunk.
- Return type: