tqec.templates.subtemplates.UniqueSubTemplates#
- class UniqueSubTemplates(subtemplate_indices: ndarray[Any, dtype[int64]], subtemplates: dict[int, ndarray[Any, dtype[int64]]])[source]#
Stores information on the sub-templates of a specific radius present on a larger Template instance.
A sub-template is defined here as a portion of a Template instantiation. In other words, a sub-template is a sub-array of the array resulting from calling the method Template.instantiate on any Template instance. The size of this sub-array is defined by its radius, which is computed according to the Manhattan distance.
For example, let’s say you have the following array from calling Template.instantiate on a Template instance:
` 1 5 6 5 6 2 7 9 10 9 10 11 8 10 9 10 9 12 7 9 10 9 10 11 8 10 9 10 9 12 3 13 14 13 14 4 `
Focusing on the top-left 9 (coordinates (1, 1) in the array), the following sub-array is a sub-template of radius 1, centered on the (1, 1) coordinate of the above instantiation:
` 1 5 6 7 9 10 8 10 9 `
Still focusing on the top-left 9, the following sub-array is a sub-template of radius 2, centered on the (1, 1) coordinate of the above instantiation:
` . . . . . . 1 5 6 5 . 7 9 10 9 . 8 10 9 10 . 7 9 10 9 `
Note the inclusion of . that are here to represent 0 (i.e., the absence of plaquette at that particular point) because there is no plaquette in the original Template instantiation.
This dataclass efficiently stores all the sub-templates of a given Template instantiation and of a given radius.
- subtemplate_indices#
an array that has the same shape as the original Template instantiation but stores sub-template indices referencing sub-templates from the subtemplates attribute. The integers in this array do NOT represent plaquette indices.
- Type:
numpy.ndarray[Any, numpy.dtype[numpy.int64]]
- subtemplates#
a store of sub-template (values) indexed by integers (keys) that link the sub-template center to the original template instantiation thanks to subtemplate_indices.
- Type:
dict[int, numpy.ndarray[Any, numpy.dtype[numpy.int64]]]
- Raises:
TQECException – if any index in self.subtemplate_indices is not present in self.subtemplates.keys().
TQECException – if any of the sub-template shapes is non-square or of even width or length.
TQECException – if not all the sub-template shapes in self.subtemplates.values() are equal.
- __init__(subtemplate_indices: ndarray[Any, dtype[int64]], subtemplates: dict[int, ndarray[Any, dtype[int64]]]) None #
Methods
__init__
(subtemplate_indices, subtemplates)Attributes
manhattan_radius