loom_repetition_code.applicator.merge

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.merge.find_merge_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 merge operation.

Parameters:
  • interpretation_step (InterpretationStep) – Interpretation step containing the blocks to be merged.

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

  • 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 and ancilla qubits.

Return type:

Circuit

loom_repetition_code.applicator.merge.find_new_stabilizers(blocks, check_type)[source]

Find the new stabilizers for the merged block.

Parameters:
  • blocks (list[RepetitionCode]) – List of blocks (capped at two) to be merged.

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

Returns:

New stabilizers for the merged block.

Return type:

list[Stabilizer]

loom_repetition_code.applicator.merge.get_logical_operator_and_evolution(blocks, check_type, new_data_qubits)[source]

Get the new logical operators and evolution for the merged block.

Parameters:
  • blocks (list[RepetitionCode]) – List of blocks (capped at two) to be merged.

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

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

Returns:

New logical operators and evolution for the merged block.

Return type:

tuple[list[list[PauliOperator]], list[dict]]

loom_repetition_code.applicator.merge.get_new_data_qubits_info(blocks)[source]

Get the new data qubits to be added in the merged block.

Parameters:

blocks (list[RepetitionCode]) – List of blocks (capped at two) to be merged.

Returns:

List of new data qubits to be added.

Return type:

list[tuple[int, int]]

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

Merge two Repetition Code chains.

The algorithm is the following:

  • A.) DATA QUBITS

    • A.1) Find the new data qubits to be added in the merged block

  • B.) CIRCUIT

    • B.1) Find the circuit for the merge operation

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

  • C.) - STABILIZERS
    • C.1) Find the new stabilizers for the merged block

  • D.) LOGICAL OPERATORS

    • D.1) Find new logical operator and evolution

    • D.2) Update the logical operator history

  • E.) NEW BLOCK AND NEW INTERPRETATION STEP

    • E.1) Create the new block

    • E.2) Update the block history

Parameters:
  • interpretation_step (InterpretationStep) – Interpretation step containing the blocks to merge.

  • operation (Merge) – Merge 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 merge operation.

Return type:

InterpretationStep

loom_repetition_code.applicator.merge.merge_consistency_check(interpretation_step, operation)[source]

Check the consistency of the merge operation.

Parameters:
  • interpretation_step (InterpretationStep) – InterpretationStep containing the blocks to merge.

  • operation (Merge) – Merge operation description.

Returns:

Blocks to merge.

Return type:

tuple[RepetitionCode,RepetitionCode]