loom_rotated_surface_code.applicator.rotate_block
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.rotate_block.get_boundary_rotation_corner_args_5_1(rsc_block)[source]
Rotate the boundaries by using move_corners 5 times, moving 1 corner at a time. The corners are moved in a way such that the distance of the block for all logical operators is at least the original distance, ensuring fault-tolerance. For this to be possible, the block must be of size (d, 2 * d - 1) or (2 * d - 1, d) with odd d.
- Parameters:
rsc_block (RotatedSurfaceCode) – The grown rectangular rotated surface code block.
- Returns:
A tuple containing 5 tuples, each specifying the arguments for a call to move_corners. Each inner tuple contains:
The coordinates of the corner to move (as a tuple of integers).
The direction in which to move the corner (as a Direction enum).
The distance to move the corner (as an integer).
- Return type:
tuple[tuple[tuple[int, …], Direction, int], …]
- loom_rotated_surface_code.applicator.rotate_block.rotate_block(interpretation_step, operation, same_timeslice, debug_mode)[source]
Rotate the boundary of a rotated surface code block by growing it in the specified direction, moving the corners in a fault-tolerant manner and shrinking back to the original size.
The rotation is performed by:
A.) Validity checks
A.1) Check that the block is a valid RotatedSurfaceCode block for RotateBlock
B.) Grow the block in the specified direction
B.1) Grow the block to double its size minus one in the specified direction
B.2) Measure syndromes to complete the grow operation
- B.3) Move the logical operators so that they are correctly located on the
top-left qubit of the grown block
C.) Move the corners appropriately
C.1) Move each corner individually
C.2) Measure syndromes to complete the corner move in a fault-tolerant manner
D.) Shrink the block
D.1) Shrink the block from the grown side by distance - 2
D.2) Shrink the block from the opposite side by 1 to return to original size
E.) Move block
E.1) Move the block so that it’s occupying the same data qubits as initially
- E.2) Move the logical operators so that they are correctly located on the
top-left qubit of the shrunk block
F.) Wrap the circuit
- F.1) Isolate the circuit corresponding to the RotateBlock operation and append
it as a single Circuit object to the intermediate circuit sequence
- Parameters:
interpretation_step (InterpretationStep) – The current interpretation step containing the block to be rotated.
operation (RotateBlock) – The RotateBlock operation specifying the block and direction.
same_timeslice (bool) – Flag to apply the operation in the same timeslice as the previous operation(s).
debug_mode (bool) – Flag to apply validation of the new block or not.
- Returns:
The updated interpretation step after applying the RotateBlock operation.
- Return type:
- loom_rotated_surface_code.applicator.rotate_block.rotate_validity_check(rsc_block)[source]
Validity checks for applying RotateBlock to a RotatedSurfaceCode block. We check that:
The block is indeed a RotatedSurfaceCode block
The block is square and has odd distance
The topological and geometric corners match