PipeKind#

class tqec.computation.PipeKind(x, y, z, has_hadamard=False)[source]#

Bases: object

The kind of a pipe in the block graph.

Looking at the head of the pipe, i.e. the side which has smaller position, the kind is determined by the wall bases there together with whether the pipe has a hadamard transition. The basis along the direction of the pipe should be None.

Parameters:
  • x (Basis | None)

  • y (Basis | None)

  • z (Basis | None)

  • has_hadamard (bool)

x#

At the head of the pipe, looking at the pipe along the x-axis, the basis of the walls observed. Can be None if the pipe connects two cubes along the x-axis.

Type:

tqec.utils.enums.Basis | None

y#

At the head of the pipe, looking at the pipe along the y-axis, the basis of the walls observed. Can be None if the pipe connects two cubes along the y-axis.

Type:

tqec.utils.enums.Basis | None

z#

At the head of the pipe, looking at the pipe along the z-axis, the basis of the walls observed. Can be None if the pipe connects two cubes along the z-axis.

Type:

tqec.utils.enums.Basis | None

has_hadamard#

Whether the pipe has a hadamard transition.

Type:

bool

Methods

__init__(x, y, z[, has_hadamard])

from_str(string)

Create a pipe kind from the string representation.

get_basis_along(direction[, at_head])

Get the wall basis of the pipe in the specified direction.

Attributes

direction

The direction along which the pipe connects the cubes.

has_hadamard

is_spatial

Whether the pipe is spatial, i.e. connects two cubes along the X or Y axis.

is_temporal

Whether the pipe is temporal, i.e. connects two cubes along the Z axis.

x

y

z

Detailed methods

__init__(x, y, z, has_hadamard=False)#
Parameters:
  • x (Basis | None)

  • y (Basis | None)

  • z (Basis | None)

  • has_hadamard (bool)

Return type:

None

static from_str(string)[source]#

Create a pipe kind from the string representation.

The string should be a 3-character or 4-character string. The first 3 characters represent the basis of the walls at the head of the pipe along the x, y, and z axes. If there is no wall along an axis, i.e. the pipe connects two cubes along that axis, the character should be “O” for open boundary. The last character, if exists, should be “H” to indicate the pipe has a hadamard transition.

Parameters:

string (str) – The string representation of the pipe kind.

Returns:

The pipe kind represented by the string.

Return type:

PipeKind

get_basis_along(direction, at_head=True)[source]#

Get the wall basis of the pipe in the specified direction.

Parameters:
  • direction (Direction3D) – The direction along which to get the basis.

  • at_head (bool) – If True, get the basis at the head of the pipe, i.e. the side which has smaller position. Otherwise, get the basis at the tail of the pipe. This matters when the pipe has hadamard transition.

Returns:

None if the direction is the same as the pipe direction. Otherwise, the basis of the wall in the specified direction.

Return type:

Basis | None