PlaquetteLayer#
- class tqec.compile.blocks.PlaquetteLayer(template, plaquettes, trimmed_spatial_borders=frozenset({}))[source]#
Bases:
BaseLayer
Represents a layer with a template and some plaquettes.
This class implements the layer interface by using a template and some plaquettes. This is the preferred way of representing a layer.
- Parameters:
template (RectangularTemplate) – template used in conjunction to
plaquettes
to represent the quantum circuit implementing the layer.plaquettes (Plaquettes) – plaquettes used in conjunction to
template
to represent the quantum circuit implementing the layer.trimmed_spatial_borders (frozenset[SpatialBlockBorder]) – all the spatial borders that have been removed from the layer.
- Raises:
TQECException – if the provided
template
increments do not match with the expected spatial border width.TQECException – if the provided
template
andtrimmed_spatial_borders
can lead to empty instantiations fork >= 1
.
Methods
__init__
(template, plaquettes[, ...])Represents a layer with a template and some plaquettes.
get_temporal_layer_on_border
(border)shape
(k)Returns the 2-dimensional shape of the object for the given
k
.timesteps
(k)Returns the number of timesteps needed to implement the object for the provided scaling parameter
k
.with_spatial_borders_trimmed
(borders)Returns
self
with the provided spatial borders removed.Returns
self
with the provided temporal borders replaced.Attributes
plaquettes
scalable_shape
Returns the 2-dimensional shape of the object as an exact expression that can then be used to compute the shape for any value of
k
.scalable_timesteps
Returns the number of timesteps needed to implement the object as an exact expression that can then be used to compute the number of timesteps for any value of
k
.template
trimmed_spatial_borders
Detailed methods
- __init__(template, plaquettes, trimmed_spatial_borders=frozenset({}))[source]#
Represents a layer with a template and some plaquettes.
This class implements the layer interface by using a template and some plaquettes. This is the preferred way of representing a layer.
- Parameters:
template (RectangularTemplate) – template used in conjunction to
plaquettes
to represent the quantum circuit implementing the layer.plaquettes (Plaquettes) – plaquettes used in conjunction to
template
to represent the quantum circuit implementing the layer.trimmed_spatial_borders (frozenset[SpatialBlockBorder]) – all the spatial borders that have been removed from the layer.
- Raises:
TQECException – if the provided
template
increments do not match with the expected spatial border width.TQECException – if the provided
template
andtrimmed_spatial_borders
can lead to empty instantiations fork >= 1
.
- Return type:
None
- get_temporal_layer_on_border(border)#
- Parameters:
border (TemporalBlockBorder)
- Return type:
- shape(k)#
Returns the 2-dimensional shape of the object for the given
k
.- Parameters:
k (int) – scaling parameter.
- Returns:
the 2-dimensional shape of the object for the given
k
.- Return type:
PhysicalQubitShape2D
- timesteps(k)#
Returns the number of timesteps needed to implement the object for the provided scaling parameter
k
.- Parameters:
k (int) – scaling parameter.
- Returns:
the number of timesteps needed to implement the object for the provided scaling parameter
k
.- Return type:
int
- with_spatial_borders_trimmed(borders)[source]#
Returns
self
with the provided spatial borders removed.- Parameters:
borders (Iterable[SpatialBlockBorder]) – spatial borders to remove.
- Returns:
a copy of
self
with the providedborders
removed.- Return type:
- with_temporal_borders_replaced(border_replacements)#
Returns
self
with the provided temporal borders replaced.- Parameters:
borders – a mapping from temporal borders to replace to their replacement. A value of
None
as a replacement means that the border is removed.border_replacements (Mapping[TemporalBlockBorder, BaseLayer | None])
- Returns:
a copy of
self
with the providedborders
replaced, orNone
if replacing the providedborders
fromself
result in an empty temporal footprint.- Return type:
BaseLayer | None