loom_repetition_code.applicator.split
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.split.create_split_circuit(interpretation_step, check_type, qubit_to_measure, circuit_name)[source]
Create the circuit for the split operation.
- Parameters:
interpretation_step (InterpretationStep) – Interpretation step containing the chain to split.
check_type (str) – Type of stabilizer to measure.
qubits_to_measure (tuple[int, int]) – Qubit to be measured in the split operation.
circuit_name (str) – Name of the circuit for the split operation.
- Returns:
Circuit for the split operation and the classical bit used in the circuit.
- Return type:
tuple[Circuit, Cbit]
- loom_repetition_code.applicator.split.find_new_stabilizers(block, qubit_to_measure)[source]
Split the initial Block stabilizers into two lists of stabilizers, one for each Block.
- Parameters:
block (RepetitionCode) – Initial block to be split
qubits_to_measure (tuple[int,int]) – Qubit to be measured in the split operation.
- Returns:
A tuple of two lists of stabilizers, one for each block.
- Return type:
tuple[list[Stabilizer], list[Stabilizer]]
- loom_repetition_code.applicator.split.find_qubit_to_measure(block, split_position)[source]
Find the qubit to measure in the split operation.
- Parameters:
block (RepetitionCode) – Block to split.
split_position (int) – Position where the chain will be split.
- Returns:
Qubit to be measured in the split operation.
- Return type:
tuple[int, int]
- loom_repetition_code.applicator.split.get_logical_operator_and_updates(int_step, block, check_type, qubit_to_measure, cbit)[source]
Finds the logical operators for the new blocks after the split operation. The logical spanning the chain will be split in two, the logical at the left end remains there for the first chain and a new one is created for the second chain, on its left end.
- Parameters:
int_step (InterpretationStep) – Interpretation step containing the block to split.
block (RepetitionCode) – Block to split.
check_type (str) – Type of stabilizer to measure.
qubit_to_measure (tuple[int,int]) – Qubit to be measured in the split operation.
cbit (Cbit) – Classical bit used to measure the qubit that splits the chain.
- Return type:
tuple[list[list[PauliOperator]],list[list[PauliOperator]],list[dict[str,tuple[str,...]]],list[dict[str,tuple[str,...]]],list[dict[str,tuple[Union[tuple[str,int],Literal[1,0]],...]]],list[dict[str,tuple[Union[tuple[str,int],Literal[1,0]],...]]]]- Returns:
tuple[ – list[list[PauliOperator]],list[list[PauliOperator]], list[dict[str, tuple[str, …]]], list[dict[str, tuple[str, …]]], list[dict[str, tuple[Cbit, …]]], list[dict[str, tuple[Cbit, …]]],
] – Tuple containing the new logical operators for the blocks, the evolution, and the updates.
- loom_repetition_code.applicator.split.split(interpretation_step, operation, same_timeslice, debug_mode)[source]
Applicator to split a Repetition Code chain using the Split description. Since the Repetition code is a 1D chain, the split operation is always vertical.
The algorithm is the following:
A.) DATA QUBITS
A.1) Find data qubit to be measured
B.) - CIRCUIT
B.1) Create a measurement circuit for the measured data qubit
B.2) Append the measurement circuits to the InterpretationStep circuit
C.) - STABILIZERS
C.1) Create two sets of stabilizers, one for each new block, after the split
D.) LOGICAL OPERATORS
D.1) Find logical operators which are not partially measured
D.2) Find logical operators which have to be split
D.3) Create new logical operators and final to initial mapping
D.4) Update logical_x/z_evolution
D.5) Update logical_x/z_updates
E.) NEW BLOCK AND NEW INTERPRETATION STEP
E.1) Create the new blocks
E.2) Update the block history
- Parameters:
interpretation_step (InterpretationStep) – Interpretation step containing the block to split.
operation (Split) – Split 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 split operation.
- Return type:
- loom_repetition_code.applicator.split.split_consistency_check(interpretation_step, operation)[source]
Check that the split operation can be performed on the given chain.
- Parameters:
interpretation_step (InterpretationStep) – InterpretationStep containing the block to split.
operation (Split) – Split operation to perform.
- Returns:
Block to split.
- Return type:
- Raises:
ValueError – If the split position is larger than the length of the chain. If the split position is at the edge of the chain. If one of the chains has a length of one.