loom_rotated_surface_code.applicator.transversalhadamard
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.transversalhadamard.transversal_hadamard_syndrome_circuits(block, interpretation_step, new_stabs, new_stabilizer_to_circuit, new_synd_circs=())[source]
For a given Block, InterpretationStep and list of new Stabilizers that result from a Transversal Hadamard operation, this generates the new SyndromeCircuit objects that are associated with the new Stabilizers. Along with the new SyndromeCircuit objects, it also generates a mapping of the new Stabilizers to the UUIDs of the new SyndromeCircuits. An initial collection of new SyndromeCircuits and a partially populated mapping of the new Stabilizers to the UUIDs of the new SyndromeCircuits can be provided as optional arguments.
- Parameters:
block (RotatedSurfaceCode) – The block of the surface code.
interpretation_step (InterpretationStep) – The interpretation step that contains the evolution of the new Stabilizers.
new_stabs (list[Stabilizer]) – The new stabilizers that result from the Transversal Hadamard operation.
new_stabilizer_to_circuit (dict[str, str]) – The partially populated mapping of the new Stabilizers to the UUIDs of the new SyndromeCircuits.
new_synd_circs (tuple[SyndromeCircuit], optional) – The new SyndromeCircuit objects that are ALREADY associated with the new Stabilizers.
- Returns:
A tuple containing the new SyndromeCircuit objects and a dictionary mapping the new Stabilizers to the UUIDs of the new SyndromeCircuits.
- Return type:
tuple[tuple[SyndromeCircuit], dict[str,str]]
- loom_rotated_surface_code.applicator.transversalhadamard.transversalhadamard(interpretation_step, operation, same_timeslice, debug_mode)[source]
Apply a Transversal Hadamard gate to a Block.
The algorithm is as follows:
- CIRCUIT
A.1) Apply Hadamard gates over all data qubits of the block.
A.2) Append Hadamard gates to the circuit within the InterpretationStep.
- STABILIZERS
B.1) Update Stabilizers (XX -> ZZ, ZZ -> XX, for 2-body stabilizers) with new UUIDs.
B.2) Record the old UUIDs and the new UUIDs of the Stabilizers. (stabilizer_evolution)
- PAULIOPERATORS
- C.1) Update PauliOperators (X to Z Operators) with new UUIDs
and logical updates.
- C.2) Update PauliOperators (Z to X Operators) with new UUIDs
and logical updates.
- SYNDROMECIRCUITS
D.1) Update Syndrome Circuits with new UUIDs.
D.2) Determine the Syndrome Circuit(s) associated with the old Stabilizer(s).
D.3) Update the Syndrome Circuit(s) for the new Stabilizer(s).
D.4) Update Collection of New Syndrome Circuits and New Stabilizer to Circuit Mapping
- NEW BLOCK
E.1) Create new Block (Same unique_label as Input Block)
- BLOCK HISTORY
G.1) Update the latest Block Configuration in InterpretationStep.
- Parameters:
interpretation_step (InterpretationStep) – Interpretation step containing the block to apply the transversal hadamard to.
operation (TransversalHadamard) – Transversal hadamard 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 transversal hadamard operation.
- Return type:
- loom_rotated_surface_code.applicator.transversalhadamard.update_synd_circ(input_synd_circ, new_pauli)[source]
Updates the input Measurement SyndromeCircuit to measure a new pauli. The input SyndromeCircuit requires a specific design where the ancilla qubits are initialized and measured in the X basis with a CX, CY or CZ gate to the data qubit. The function replaces the two-qubit gate with a new gate that measures the new_pauli. If the new pauli is a Z, the function replaces the two-qubit gate with a CZ gate. If the new pauli is an X, the function replaces the two-qubit gate with a CX gate. If the new pauli is a Y, the function replaces the two-qubit gate with a CY gate.
- Parameters:
input_synd_circ (SyndromeCircuit) – The input syndrome circuit.
new_pauli (str) – The new pauli the circuit will be measuring now.
- Return type:
- Returns:
SyndromeCircuit: The updated syndrome circuit.