tqec.templates.grid.GridTemplate
- class GridTemplate(index_grid: Sequence[Sequence[int]], tiled_template: RectangularTemplate, k: int = 2, default_increments: Displacement | None = None)[source]
- __init__(index_grid: Sequence[Sequence[int]], tiled_template: RectangularTemplate, k: int = 2, default_increments: Displacement | None = None) None [source]
A grid of the same repeating template.
This class provides a way to efficiently represent a 2-dimensional grid of the same RectangularTemplate instance tiled all over the grid.
- Parameters:
index_grid – a sequence of rows representing the arrangement of the provided tiled_template with integer indices. An entry of 0 means “empty” or “no template”. Then, each entry strictly above 1 represent an instance of tiled_template on the grid. Entries with the same value (e.g., in [[1, 0], [1, 0]], two entries have the value 1) represent tiled_template instances that will share the same plaquette indices.
tiled_template – base RectangularTemplate instance that will be tiled over a grid.
k – scaling factor forwarded to the template instances composing the grid. Defaults to 2.
default_increments – default increments between two plaquettes.
- Raises:
TQECException – if the provided grid is empty (e.g., []).
TQECException – if the provided grid has empty rows (e.g., [[]]).
TQECException – if the provided grid indices are not a contiguous sequence of integers starting from either 0 or 1.
Methods
__init__
(index_grid, tiled_template[, k, ...])A grid of the same repeating template.
get_increments
()Get the default increments of the template.
get_midline_plaquettes
([orientation])Returns the default observable qubits for the template.
get_plaquette_indices_on_sides
(_)Get the indices of plaquettes that are located on the provided sides.
get_spatially_distinct_subtemplates
([...])Returns a representation of all the distinct sub-templates of the provided manhattan radius.
instantiate
([plaquette_indices])Generate the numpy array representing the template.
scale_to
(k)Scales self to the given scale k.
Attributes
expected_plaquettes_number
Returns the number of plaquettes expected from the instantiate method.
k
scalable_shape
Returns a scalable version of the template shape.
shape
Returns the current template shape.