loom.interpreter.interpreter
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.interpreter.interpreter.cleanup_final_step(final_step)[source]
Clean up the final interpretation step before it is returned to the user.
- Parameters:
final_step (InterpretationStep) – Final interpretation step which should be cleaned up before returning it to the user
- Returns:
Cleaned up interpretation step
- Return type:
- loom.interpreter.interpreter.interpret_eka(eka, debug_mode=True)[source]
Interpret the Eka object and return the final InterpretationStep. The function iterates over all operations in the Eka and applies them to the current InterpretationStep. The function also handles the case where multiple operations are applied in parallel during the same timestep.
- Parameters:
eka (Eka) –
- Eka object describing the operations to perform, as well as the initial state
of the blocks.
debug_mode (bool) – Flag indicating whether the interpretation should be done in debug mode. Activating debug mode will enable commutation validation for Block
- Returns:
Final InterpretationStep containing the interpreted operations and the final circuit.
- Return type:
- loom.interpreter.interpreter.interpret_operation(eka, step, op, same_timeslice, debug_mode)[source]
This function interprets the given operation and returns a new InterpretationStep which contains all modifications due to the operation. The function itself finds the right applicator for the given operation and calls it. The actual implementation of the operation is done in the applicator.
- Parameters:
eka (Eka) – The Eka object for which the operation should be interpreted. The Eka is passed on to the applicator. This allows the applicator to access the lattice and the syndrome circuits
step (InterpretationStep) – Current InterpretationStep to which the modifications due to the operation should be applied
op (
loom.eka.operations.base_operation.Operation) – Operation to be interpretedsame_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. Currently, the effects of debug mode are: - Disabling the commutation validation of Block
- Returns:
New InterpretationStep containing all modifications due to the operation
- Return type: