Pipe#

class tqec.computation.Pipe(u, v, kind)[source]#

Bases: object

A block connecting two Cube objects.

The pipes connect the cubes in the block graph. Topologically, the pipes open the boundaries of the cubes and wire them together to form the topological structure representing the computation. In the circuit level, the pipes make modifications to the blocks of operations represented by the cubes. Importantly, the pipes themselves do not occupy spacetime volume.

WARNING: The attributes u and v will be ordered to ensure the position of u is less than v.

Parameters:
u#

The cube at the head of the pipe. The position of u will be guaranteed to be less than v.

Type:

tqec.computation.cube.Cube

v#

The cube at the tail of the pipe. The position of v will be guaranteed to be greater than u.

Type:

tqec.computation.cube.Cube

kind#

The kind of the pipe.

Type:

tqec.computation.pipe.PipeKind

Methods

__init__(u, v, kind)

check_compatible_with_cubes()

Check if the pipe is compatible with the cubes it connects.

from_cubes(u, v)

Construct a pipe connecting two cubes and infer the pipe kind.

Attributes

direction

The direction along which the pipe connects the cubes.

u

v

kind

Detailed methods

__init__(u, v, kind)#
Parameters:
Return type:

None

check_compatible_with_cubes()[source]#

Check if the pipe is compatible with the cubes it connects.

For compatibility, each cube (head and tail) must match the pipe’s basis along each direction, except for the direction of the pipe, if the cube is of type ZXCube.

Raises:

TQECException – If the pipe is not compatible with the cubes.

Return type:

None

static from_cubes(u, v)[source]#

Construct a pipe connecting two cubes and infer the pipe kind.

Parameters:
  • u (Cube) – The first cube.

  • v (Cube) – The second cube.

Returns:

The pipe connecting the two cubes.

Raises:
  • TQECException – If the cubes are not neighbours or both of them are not ZX cubes.

  • TQECException – If kind of the pipe cannot be inferred from the cubes.

Return type:

Pipe