Cubical complex user manual#
Definition#
![]() |
The cubical complex represents a grid as a cell complex with cells of all dimensions. |
|
![]() |
||
![]() |
The cubical complex is an example of a structured complex useful in computational mathematics (specially rigorous numerics) and image analysis.
An elementary interval is an interval of a form
(when working with a field of characteristic other than 2, the non-zero terms of this sum come with alternating signs ±1).
A cubical complex
Cubes may be equipped with a filtration values in which case we have filtered cubical complex. All the cubical complexes considered in this implementation are filtered cubical complexes (although, the range of a filtration may be a set of two elements).
For further details and theory of cubical complexes, please consult [23] as well as the following paper [30].
Data structure#
The implementation of Cubical complex provides a representation of complexes that occupy a rectangular region in

Cubical complex.#
Note that the cubical complex in the figure above is, in a natural way, a product of one dimensional cubical
complexes in
Construction#
In the current implantation, filtration is given either at the maximal cubes or at the vertices, and it is then extended by the lower star filtration to all cubes. There are a number of constructors that can be used to construct cubical complex by users who want to use the code directly. They can be found in the Cubical complex reference manual.
from gudhi import CubicalComplex
import numpy as np
cc = CubicalComplex(top_dimensional_cells=np.array([[ 1., 8., 7.],
[ 4., 20., 6.],
[ 6., 4., 5.]]))
print(f"Cubical complex is of dimension {cc.dimension()} - {cc.num_simplices()} simplices.")
the program output is:
Cubical complex is of dimension 2 - 49 simplices.
Periodic boundary conditions#
Often one would like to impose periodic boundary conditions to the cubical complex (cf.
Periodic cubical complex reference manual).
Let
It can be defined as follows:
from gudhi import PeriodicCubicalComplex as PCC
pcc = PCC(top_dimensional_cells = [[0, 0, 0], [0, 1, 0], [0, 0, 0]],
periodic_dimensions=[True, False])
print(f"Periodic cubical complex is of dimension {pcc.dimension()} - {pcc.num_simplices()} simplices.")
the program output is:
Periodic cubical complex is of dimension 2 - 42 simplices.
Examples#
End user programs are available in python/example/ folder.
Tutorial#
This notebook explains how to represent sublevels sets of functions using cubical complexes.