loom_repetition_code.applicator.grow

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_repetition_code.applicator.grow.create_grow_circuit(interpretation_step, check_type, new_data_qubits, circuit_name)[source]

Generates the circuit required to reset the new data that get added during the grow operation.

Parameters:
  • interpretation_step (InterpretationStep) – Interpretation step containing the block to grow.

  • check_type (str) – Type of stabilizers in the code.

  • new_data_qubits (list[tuple[int,int]]) – List of new data qubits to reset.

  • circuit_name (str) – Name of the circuit.

Returns:

Circuit to reset the new data qubits.

Return type:

Circuit

loom_repetition_code.applicator.grow.find_new_stabilizers(block, check_type, is_left, new_data_qubits)[source]

Find the new stabilizers that will form the grown block.

Parameters:
  • block (RepetitionCode) – Block to grow.

  • check_type (str) – Type of stabilizer to add.

  • is_left (bool) – Whether the grow operation is to the left or right.

  • new_data_qubits (list[tuple[int,int]]) – New data qubits to add.

Returns:

List containing the new stabilizers forming the grown block.

Return type:

list[Stabilizer]

loom_repetition_code.applicator.grow.get_logical_operator_and_evolution(block, check_type, new_data_qubits)[source]

Extract the logical operators and the evolution after the grow operation.

Parameters:
  • block (RepetitionCode) – Block to grow.

  • check_type (str) – Type of stabilizer defining the code.

  • new_data_qubits (list[tuple[int,int]]) – New data qubits to add.

Returns:

Tuple containing the new logical operators, the evolution of the logical X operators, and the evolution of the logical Z operators.

Return type:

tuple[list[list[PauliOperator]], list[dict[str, tuple[str, …]]]]

loom_repetition_code.applicator.grow.get_new_data_qubits_info(block, direction, length)[source]

Find the qubits to add during the grow operation.

Parameters:
  • block (RepetitionCode) – Block to grow.

  • direction (Direction) – Direction of the grow operation.

  • length (int) – Length of the grow operation.

Returns:

List containing the new qubits to add.

Return type:

list[tuple[int, int]]

loom_repetition_code.applicator.grow.grow(interpretation_step, operation, same_timeslice, debug_mode)[source]

Grow a Repetition Code chain in the specified direction (left or right).

The algorithm is the following:

  • A.) DATA QUBITS

    • A.1) Extract new data qubits

  • B.) CIRCUIT

    • B.1) Generate the circuit

    • B.2) Add the circuit to the interpretation step

  • C.) STABILIZERS

    • C.1) Find the new stabilizers that get added

    • C.2) Add to current set of stabilizers

  • D.) LOGICAL OPERATORS

    • D.1) Extract logical operators and updates

    • D.2) Update the logical operator history

  • E.) NEW BLOCK

    • E.1) Create the new block

    • E.2) Update the block history

Parameters:
  • interpretation_step (InterpretationStep) – Interpretation step containing the block to grow.

  • operation (Grow) – Grow 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 grow operation.

Return type:

InterpretationStep

loom_repetition_code.applicator.grow.grow_consistency_check(interpretation_step, operation)[source]

Check the consistency of the grow operation.

Parameters:
  • interpretation_step (InterpretationStep) – InterpretationStep containing the block to grow.

  • operation (Grow) – Grow operation description.

Return type:

RepetitionCode

Returns:

The RepetitionCode block to grow.

Raises:

ValueError – If the Block is not RepetitionCode. If the grown operation direction is not RIGHT or LEFT. If growing in the left direction goes beyond the lattice boundary.