tqec.compile.blocks#

Provide a flexible representation to define blocks, the basic unit of computation in topological error corrected codes.

The main data-structure provided by this module is Block. It is able to represent in a flexible manner anything that looks like a block in a topological computation represented using SketchUp. In particular, that data-structure can be used to represent both cubes and pipes.

In a topological computation, Block instances will happen in parallel, and tqec needs to account for that: operations happening in parallel should be encoded in the same moment (i.e., between the same two TICK instructions) in the resulting .stim file.

Moreover, blocks might have different “schedules”. For example, the regular memory block follow the schedule:

  1. initialisation layer,

  2. repeat [memory layer],

  3. measurement layer,

whereas a spatial pipe in the Y axis needs to alternate plaquettes in its repeated layer, leading to a schedule that is:

  1. initialisation layer,

  2. repeat [memory layer 1 alternated with memory layer 2],

  3. measurement layer.

All these restrictions are handled by representing Block instances with BaseLayer and BaseComposedLayer instances. See tqec.compile.blocks.layers for more details.

Functions

merge_parallel_block_layers(...)

Merge several stacks of layers executed in parallel into one stack of larger layers.

Classes

BaseComposedLayer([trimmed_spatial_borders])

Base class representing a composed "layer".

BaseLayer([trimmed_spatial_borders])

Base class representing a "layer".

Block(layer_sequence[, trimmed_spatial_borders])

Encodes the implementation of a block.

LayoutLayer(layers, element_shape)

A layer gluing several other layers together on a 2-dimensional grid.

LayoutPosition2D(x, y)

Internal class to represent the local indexing used to represent both cubes and pipes.

PlaquetteLayer(template, plaquettes[, ...])

Represents a layer with a template and some plaquettes.

RawCircuitLayer(circuit_factory, ...[, ...])

Represents a layer with a spatial footprint that is defined by a raw circuit.

RepeatedLayer(internal_layer, repetitions[, ...])

Composed layer implementing repetition.

SequencedLayers(layer_sequence[, ...])

Composed layer implementing a fixed sequence of layers.

SpatialBlockBorder(value[, names, module, ...])

Enumerates the 4 different spatial borders for a block.

TemporalBlockBorder(value[, names, module, ...])

Enumerates the 2 different temporal borders for a block.