pqca.tessellation module¶
Create a tessellation from a list of qubits.
- class pqca.tessellation.Tessellation(cells: List[List[int]])¶
Bases:
objectDescribes how to partition the lattice into cells.
This is a list of lists of qubits (expressed as integers) that also performs some validation.
- cells: List[List[int]]¶
- shifted_by(amount=1) → pqca.tessellation.Tessellation¶
Shift the tessellation along by the specified amount.
Equivalent to calling update_names with a function that adds amount to every qubit name.
- Parameters
amount (int, optional) – The amount, positive or negative, to increase each qubit’s name. Defaults to 1. Acts modulo the number of qubits in the tessellation.
- Returns
A new tessellation with shifted names.
- Return type
- size: int¶
- update_names(name_update: Callable[[int], int], rename_modulo_size=True) → pqca.tessellation.Tessellation¶
Create a new tessellation by renaming every qubit in the old one.
The function name_update is applied to each current qubit name. This renaming will happen modulo the number of qubits unless explicitly asked not to.
- Parameters
name_update (Callable[[int], int]) – Function to apply to each name.
rename_modulo_size (bool, optional) – After applying the rename enforce names module the number of qubits. Defaults to True.
- Returns
A new tessellation with the applied renaming.
- Return type
- pqca.tessellation.n_dimensional(qubits_in_each_dimension: List[int], cell_size: List[int]) → pqca.tessellation.Tessellation¶
Partition an n-dimensional lattice into n-dimensional cuboids.
example qubits_in_each_dimension: [5,5,10] for a cuboid of size 5 by 5 by 10 example cell_size: [5,5,2]
Note that the size of the cell must divide (for each dimension) the number of qubits in the lattice.
- Parameters
qubits_in_each_dimension (List[int]) – Width in each dimension.
cell_size (List[int]) – Shape of the cells that will cover all the qubits.
- Raises
exceptions.IrregularCoordinateDimensions – The cells must evenly cover the whole space.
- Returns
A partition of the large space into cells, each cell being a list of qubits.
- Return type
- pqca.tessellation.one_dimensional(num_qubits: int, cell_size: int) → pqca.tessellation.Tessellation¶
Partition a line of length num_qubits into cells of size cell_size.
Equivalent to a call to n_dimensional.
- Parameters
num_qubits (int) – Number of qubits to partition.
cell_size (int) – Number of qubits to fit in each cell.
- Returns
Partition of the line into equal-sized cells.
- Return type