The CubicalComplex is an example of a structured complex useful in computational mathematics (specially rigorous numerics) and image analysis.
See also
Other data structures for cell complexes:
PeriodicCubicalComplex
,
SimplexTree
Methods
Method new()
Constructor from either top_dimensional_cells
(and
possibly dimensions
) or from a Perseus-style file name.
Usage
CubicalComplex$new(
perseus_file,
top_dimensional_cells,
dimensions = NULL,
py_class = NULL
)
Arguments
perseus_file
A character string specifying the path to a Perseus-style file name.
top_dimensional_cells
Either a numeric vector (in which case,
dimensions
should be provided as well) or a multidimensional array specifying cell filtration values.dimensions
An integer vector specifying the number of top dimensional cells. Defaults to
NULL
.py_class
An existing
CubicalComplex
Python class. Defaults toNULL
which uses the Python class constructor instead.
Method betti_numbers()
This function returns the Betti numbers of the complex.
Method cofaces_of_persistence_pairs()
A persistence interval is described by a pair of cells, one that creates the feature and one that kills it. The filtration values of those 2 cells give coordinates for a point in a persistence diagram, or a bar in a barcode. Structurally, in the cubical complexes provided here, the filtration value of any cell is the minimum of the filtration values of the maximal cells that contain it. Connecting persistence diagram coordinates to the corresponding value in the input (i.e. the filtration values of the top-dimensional cells) is useful for differentiation purposes.
Details
This function returns a list of pairs of top-dimensional cells corresponding to the persistence birth and death cells of the filtration. The cells are represented by their indices in the input list of top-dimensional cells (and not their indices in the internal data structure that includes non-maximal cells). Note that when two adjacent top-dimensional cells have the same filtration value, we arbitrarily return one of the two when calling the function on one of their common faces.
Returns
The top-dimensional cells/cofaces of the positive and negative
cells, together with the corresponding homological dimension, in two
lists of integer arrays. The first list contains the regular
persistence pairs, grouped by dimension. It contains numpy arrays of
shape [number_of_persistence_points, 2]
. The indices of the arrays in
the list correspond to the homological dimensions, and the integers of
each row in each array correspond to: (index of positive top-dimensional cell, index of negative top-dimensional cell)
. The
second list contains the essential features, grouped by dimension. It
contains numpy arrays of shape [number_of_persistence_points, 1]
. The
indices of the arrays in the list correspond to the homological
dimensions, and the integers of each row in each array correspond to:
(index of positive top-dimensional cell)
.
Method compute_persistence()
This method computes the persistence of the complex, so it
can be accessed through $persistent_betti_numbers()
,
$persistence_intervals_in_dimension()
, etc. It is equivalent to the
$persistence()
method when you do not want the list $persistence()
returns.
Arguments
homology_coeff_field
An integer value specifying the homology coefficient field. Must be a prime number. Defaults to
11L
. Maximum is46337L
.min_persistence
A numeric value specifying the minimum persistence value to take into account (strictly greater than
min_persistence
). Defaults to0.0
. Setmin_persistence = -1.0
to see all values.
Method persistence()
This function computes and returns the persistence of the complex.
Arguments
homology_coeff_field
An integer value specifying the homology coefficient field. Must be a prime number. Defaults to
11L
. Maximum is46337L
.min_persistence
A numeric value specifying the minimum persistence value to take into account (strictly greater than
min_persistence
). Defaults to0.0
. Setmin_persistence = -1.0
to see all values.
Returns
A tibble
listing all persistence feature
summarised by 3 variables: dimension
, birth
and death
.
Method persistence_intervals_in_dimension()
This function returns the persistence intervals of the complex in a specific dimension.
Returns
A tibble
storing the persistence intervals
by row.
Method persistent_betti_numbers()
This function returns the persistent Betti numbers of the complex.
Examples
if (FALSE) { # reticulate::py_module_available("gudhi")
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc
}
if (FALSE) { # reticulate::py_module_available("gudhi")
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$compute_persistence()$betti_numbers()
}
if (FALSE) { # reticulate::py_module_available("gudhi")
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$compute_persistence()$cofaces_of_persistence_pairs()
}
if (FALSE) { # reticulate::py_module_available("gudhi")
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$dimension()
}
if (FALSE) { # reticulate::py_module_available("gudhi")
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$num_simplices()
}
if (FALSE) { # reticulate::py_module_available("gudhi")
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$persistence()
}
if (FALSE) { # reticulate::py_module_available("gudhi")
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$compute_persistence()$persistence_intervals_in_dimension(0)
}
if (FALSE) { # reticulate::py_module_available("gudhi")
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$compute_persistence()$persistent_betti_numbers(0, 1)
}