loom_rotated_surface_code.applicator.logical_phase_via_ywall

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.logical_phase_via_ywall.check_consistency(interpretation_step, operation)[source]

Check that the block is consistent with the logical phase via y-wall operation.

Parameters:
  • interpretation_step (InterpretationStep) – The InterpretationStep that contains the block to which the operation is applied.

  • operation (LogicalPhaseViaYwall) – The operation to be applied.

Returns:

The block to which the operation is applied.

Return type:

RotatedSurfaceCode

Raises:

ValueError – If the block is not square and has does not have odd dimensions. If the topological corners do not coincide with the geometric corners.

loom_rotated_surface_code.applicator.logical_phase_via_ywall.logical_phase_via_ywall(interpretation_step, operation, same_timeslice, debug_mode)[source]

Apply the logical phase via y-wall operation. The algorithm is the following:

    1. Begin LogicalPhaseViaYwall composite operation session

    1. Run consistency checks

    1. Relocate the x logical operator to the appropriate position

    1. Grow the block

    1. Move a corner to prepare for the y-wall operation

    1. Measure the syndromes

    1. Apply the y_wall_out operation

    1. Move all topological corners back to their geometric positions and potentially grow the block towards the initial position

    1. Shrink the block

    1. Relocate the x logical operator to the initial position

    1. End the composite operation session and append the circuit

Note that whenever the logical operator is moved, there may be some extra cycles of measurement of the block syndromes if there are missing syndromes.

Parameters:
  • interpretation_step (InterpretationStep) – The current state of the interpretation step.

  • operation (LogicalPhaseViaYwall) – The operation to be applied.

  • same_timeslice (bool) – Whether to apply the operation in the same timeslice or not.

  • debug_mode (bool) – Whether to run in debug mode or not.

Returns:

The updated interpretation step after applying the operation.

Return type:

InterpretationStep

loom_rotated_surface_code.applicator.logical_phase_via_ywall.move_logical(interpretation_step, current_block, new_up_left_qubit, pauli)[source]

Move the logical operator to a new position. If the logical operator is already in the new position, no action is taken. If the logical operator is not in the new position, it is moved to the new position and the stabilizers are redefined. We assume that the block is square and its logical operator is a straight line. Can be used for both X and Z logical operators.

Parameters:
  • interpretation_step (InterpretationStep) – The current state of the interpretation step.

  • current_block (RotatedSurfaceCode) – The block to which the operation is applied.

  • new_up_left_qubit (tuple[int, int, int]) – The new position of the top-left qubit of the logical x operator.

  • pauli (str) – The logical operator to be moved. Can be either “X” or “Z”.

Return type:

tuple[InterpretationStep, RotatedSurfaceCode]

Returns:

  • interpretation_step (InterpretationStep) – The updated interpretation step after applying the operation.

  • current_block (RotatedSurfaceCode) – The updated block after applying the operation.

Raises:

SyndromeMissingError – If syndromes required to redefine the logical x operator are missing.