Points and Lattices

The Point Class

class py_qcode.Point(coords, error=None, syndrome=None, inferred_error=None)

Represents a point in two or three dimensions. Normally, I’d use a namedtuple, because I’m not a psychopath, but I want to use default arguments without getting too fancy. Each point can also contain a value denoting the error which an ErrorModel has applied to that point, and/or a syndrome which results from measurement of an ErrorCorrectingCode on the lattice.

Parameters:
  • coords (tuple of ints) – co-ordinates of the point in question.
  • error (any) – A value which denotes an error. An ErrorCorrectingCode must check that this value corresponds to an operator which can be translated into a syndrome.
  • syndrome (any) – A value which denotes an syndrome. A Decoder must check that this value corresponds to an operator which can be translated into a syndrome.
clear()

Lattices

class py_qcode.Lattice(points, dim, dist=None, is_ft=False, size=None, is_dual=False)

A collection of points. Superclass to SquareLattice, SquareOctagonLattice, UnionJackLattice, whatever other convenient lattices I put in.

Represents a arbitrary-dimensional lattice of points with integer co-ordinates on which a stabilizer code can be defined. Note that, although the word “lattice” is used to describe these objects, the only requirement is that its constituent points have co-ordinates. No property of the graph structure is assumed, especially planarity.

Parameters:
  • points (list of py_qcode.Point objects) – collection of points on the lattice.
  • dist (function) – Returns the distance between two points. Note: In order to perform MWPM decoding, only the dual lattice needs a distance function.
  • is_ft (bool) – indicates whether the lattice is to possess an extra dimension for fault-tolerant decoding.
  • closed_boundary (bool) – Indicates whether to identify the Nth co-ordinate with the zeroth co-ordinate in every dimension.
clear()

Defined Lattices

class py_qcode.SquareLattice(sz_tpl, is_dual=False, is_ft=False, closed_boundary=True, rough_sides=('u', 'r'))

Represents a lattice in which qubits are placed on the edges of a grid of squares with size given by sz_tpl.

Parameters:rough_sides (tuple of strings) – Denotes which, if any, of the sides of the lattice are to have ‘rough’ boundary conditions. Values in rough_sides must be drawn from ['u', 'd', 'r', 'l', 'f', 'b'] (up, down, left, right, front, back). Default is (‘u’,’r’).
min_distance_path(dual_start, dual_end, synd_type=None)

Returns a canonical minimum distance path on the _primal_ lattice between two points of the _dual_ lattice. This is based on cutting as few corners as possible on the minimum-size bounding box. The final path is the union of minimum distance paths between start, corners, and end.

neighbours(location)

Returns a list of points which are one unit of distance away from a given location. Convenience method used to define stars and plaquettes below.

June 6, 2014: Only supports closed_boundary

TODO: Make this depend on the distance function, so that it can be made a method of Lattice, overridden by SquareLattice.

plaquettes()
stars()
class py_qcode.SquareOctagonLattice(sz_tpl, is_dual=False, is_ft=False, closed_boundary=True, rough_sides=('u', 'r'))

Represents a lattice in which qubits are placed on the corners of squares/octagons. This lattice results from allowing each point on the edge of a SquareLattice (TM) to expand into a square. Begins by creating a square grid of points according to a size tuple, identically to SquareLattice, with each coordinate passed through an affine map. Each point in this lattice is then ‘graduated’ to a square consiting of nearest neighbours.

min_distance_path(dual_start, dual_end, synd_type)

Returns a canonical minimum distance path on the _primal_ lattice between two points of the _dual_ lattice. This is based on finding the path between neighbouring octagons of whatever dual coordinates are fed in, and testing to see which sets of neighbours are optimal.

squares()
x_octagons()
z_octagons()
class py_qcode.UnionJackLattice(sz_tpl, is_dual=True, is_ft=False, closed_boundary=True, rough_sides=('u', 'r'))

Gives the dual lattice to the SquareOctagonLattice above.

Table Of Contents

Previous topic

Simulation Objects

Next topic

Error Correcting Codes

This Page