shapes.Cube

class rewalt.shapes.Cube

Bases: Shape

Subclass of Shape for oriented cubes.

The methods of this class provide a full implementation of the category of cubes with connections, which is generated by the face, degeneracy, and connection maps between cubes one dimension apart.

Use Shape.cube() to construct.

Examples

We create a 1-cube (arrow), 2-cube (square), and 3-cube (cube).

>>> arrow = Shape.cube(1)
>>> square = Shape.cube(2)
>>> cube = Shape.cube(3)

We can then check some of the relations between cubical face, connection, and degeneracy maps.

>>> map1 = square.cube_degeneracy(2).then(
...     arrow.cube_degeneracy(1))
>>> map2 = square.cube_degeneracy(1).then(
...     arrow.cube_degeneracy(1))
>>> assert map1 == map2
>>> map3 = square.cube_face(0, '+').then(
...     cube.cube_face(2, '-'))
>>> map4 = square.cube_face(1, '-').then(
...     cube.cube_face(0, '+'))
>>> assert map3 == map4
>>> map5 = square.cube_connection(1, '-').then(
...     arrow.cube_connection(0, '-'))
>>> map6 = square.cube_connection(0, '-').then(
...     arrow.cube_connection(0, '-'))
>>> assert map5 == map6

Methods

cube_connection(k, sign)

Returns one of the "connection" collapse maps of the cube one dimension higher.

cube_degeneracy(k)

Returns one of the "degeneracy" collapse maps of the cube one dimension higher.

cube_face(k, sign)

Returns one of the face inclusion maps of the cube.

cube_face(k, sign)

Returns one of the face inclusion maps of the cube.

Parameters
  • k (int) – Index of the face map, ranging from 0 to self.dim - 1.

  • sign (str) – Side: '-' or '+'.

Returns

cube_face – The face map.

Return type

ShapeMap

Raises

ValueError – If the index is out of range.

cube_degeneracy(k)

Returns one of the “degeneracy” collapse maps of the cube one dimension higher.

Parameters

k (int) – The index of the degeneracy map, ranging from 0 to self.dim.

Returns

cube_degeneracy – The degeneracy map.

Return type

ShapeMap

Raises

ValueError – If the index is out of range.

cube_connection(k, sign)

Returns one of the “connection” collapse maps of the cube one dimension higher.

Parameters
  • k (int) – Index of the connection map, ranging from 0 to self.dim - 1.

  • sign (str) – Side: '-' or '+'.

Returns

cube_face – The connection map.

Return type

ShapeMap

Raises

ValueError – If the index is out of range.