Lattice

class Lattice(u_vec=None, v_vec=None, size=None, points=None)[source]

Bases: object

Lattice on which tiles are tiled

Parameters:
  • u_vec ([type], optional) – Zeroth basis vector. Defaults to None.

  • v_vec ([type], optional) – First basis vector. Defaults to None.

  • size ([type], optional) – Width/Height of lattice. Defaults to None.

  • points ([type], optional) – Points on generated lattice. Defaults to None.

Raises:

QiskitError – Something went wrong.

Methods

apply_transform_from(lattice)[source]

Apply transformation to self from lattice

Return type:

Lattice

find_pre_transform_length(size)[source]

Shear length.

Parameters:

size (int|float) – size

generate_points(size)[source]

lattice of size points centered at (0,0)

Parameters:

size (int|float) – size vector for lattice of points

Return type:

List

classmethod make_transform(u_vec, v_vec)[source]

Generate a transformation to be used by other lattices

restrict(region, *, in_place=False)[source]

Create a new lattice with same basis but that fits inside the supplied region

Parameters:
  • region (GeometryBounds) – region to which the lattice will be restricted.

  • in_place (bool) – Modify lattice in place. Default is False

Raises:

QiskitError – something went wrong

Returns:

A new lattice with same basis vectors as self but

restricted to bounding_box

Return type:

Lattice

restrict_for_tiling(region, *, tile=None, size=None, expand_value=None, in_place=False, alpha=1)[source]

Given a Shape to tile based on the lattice (self), restrict lattice (self) to the provided shape such that a tiling of that shape with the given tile will completely fill that shape. A size can be provided instead of a tile. If both are provided the size attribute will be used. If no Tile or size is provided then it will be assumed that a tiling will use tiles of the size of the lattices (self) given basis.

Parameters:
  • region (Shape) – region that needs to be tiled

  • tile (Tile, optional) – Tile to be used for tiling. Defaults to None.

  • size (List[Union[float, int]], optional) – Size of tile. Defaults to None.

  • expand_value (np.array, optional) – Amount to expand the region AABB by

  • then (to ensure that the entire region is filled. If no expand_value is provied)

  • None. (an approximate value will be determined. Defaults to)

  • in_place (bool, optional) – Perform in place on lattice if set to True. Defaults to False.

  • alpha (float) – tile_size = alpha * tile.size - Used for optimization of a factory

Returns:

Lattice for tiling region, or None if done in place.

Return type:

Union[Lattice, None]