loom.eka.eka

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.

class loom.eka.eka.Eka(*args, **kwargs)[source]

Bases: object

This dataclass contains all the information necessary to execute a logical circuit with embedded error correction.

Parameters:
  • lattice (Lattice) – Lattice on which the Eka is defined

  • blocks (tuple[Block, ...]) – Inital state of the block defining the logical qubits.

  • operations (tuple[loom.eka.operations.base_operation.Operation, …] | tuple[tuple[loom.eka.operations.base_operation.Operation, …], …]) – Operations to be executed on the block. Each tuple of operations is executed in parallel. The operations are executed in the order they are given in the tuple but their circuits are combined such that they can be executed in parallel. If the operations are specified as a tuple of operations, they are executed sequentially.

asdict()[source]

Create a dictionary representation of the Eka object.

Return type:

dict

blocks: tuple[Block, ...] = FieldInfo(annotation=tuple[Block, ...], required=False, default_factory=tuple, validate_default=False)
classmethod blocks_unique_labels(blocks)[source]

Check that blocks have unique labels.

Return type:

tuple[Block, ...]

classmethod blocks_valid_indices(blocks, info)[source]

Check that blocks have valid qubit indices. Every element in the tuple has to be larger or equal to 0 and smaller than the size of the lattice in the respective dimension (if the lattice has a finite size).

Return type:

tuple[Block, ...]

classmethod fromdict(data_dict)[source]

Instantiate an Eka object from a dictionary.

Return type:

Eka

lattice: Lattice
operations: tuple[Operation, ...] | tuple[tuple[Operation, ...], ...] = FieldInfo(annotation=Union[tuple[Operation, ...], tuple[tuple[Operation, ...], ...]], required=False, default_factory=tuple, validate_default=False)
classmethod operations_disjoint(operations)[source]

Check that operations are disjoint, i.e. no block is used in multiple operations. Casts the operations to a tuple of tuples if it is a tuple of operations.