CubicalComplex | R Documentation |
The CubicalComplex is an example of a structured complex useful in computational mathematics (specially rigorous numerics) and image analysis.
rgudhi::PythonClass
-> CubicalComplex
new()
Constructor from either top_dimensional_cells
(and
possibly dimensions
) or from a Perseus-style file name.
CubicalComplex$new( perseus_file, top_dimensional_cells, dimensions = NULL, py_class = NULL )
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 to
NULL
which uses the Python class constructor instead.
A new CubicalComplex
object.
betti_numbers()
This function returns the Betti numbers of the complex.
CubicalComplex$betti_numbers()
The $betti_numbers()
method always returns [1, 0, 0, ...]
as
infinity filtration cubes are not removed from the complex.
An integer vector storing the Betti numbers.
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.
CubicalComplex$cofaces_of_persistence_pairs()
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.
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)
.
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.
CubicalComplex$compute_persistence( homology_coeff_field = 11, min_persistence = 0 )
homology_coeff_field
An integer value specifying the homology
coefficient field. Must be a prime number. Defaults to 11L
. Maximum
is 46337L
.
min_persistence
A numeric value specifying the minimum persistence
value to take into account (strictly greater than min_persistence
).
Defaults to 0.0
. Set min_persistence = -1.0
to see all values.
The updated CubicalComplex
class itself invisibly.
dimension()
This function returns the dimension of the complex.
CubicalComplex$dimension()
An integer value giving the complex dimension.
num_simplices()
This function returns the number of all cubes in the complex.
CubicalComplex$num_simplices()
An integer value giving the number of all cubes in the complex.
persistence()
This function computes and returns the persistence of the complex.
CubicalComplex$persistence(homology_coeff_field = 11, min_persistence = 0)
homology_coeff_field
An integer value specifying the homology
coefficient field. Must be a prime number. Defaults to 11L
. Maximum
is 46337L
.
min_persistence
A numeric value specifying the minimum persistence
value to take into account (strictly greater than min_persistence
).
Defaults to 0.0
. Set min_persistence = -1.0
to see all values.
A tibble
listing all persistence feature
summarised by 3 variables: dimension
, birth
and death
.
persistence_intervals_in_dimension()
This function returns the persistence intervals of the complex in a specific dimension.
CubicalComplex$persistence_intervals_in_dimension(dimension)
dimension
An integer value specifying the desired dimension.
A tibble
storing the persistence intervals
by row.
persistent_betti_numbers()
This function returns the persistent Betti numbers of the complex.
CubicalComplex$persistent_betti_numbers(from_value, to_value)
from_value
A numeric value specifying the persistence birth limit
to be added in the numbers (persistent birth <= from_value
).
to_value
A numeric value specifying the persistence death limit to
be added in the numbers (persistent death > to_value
).
An integer vector storing the persistent Betti numbers.
clone()
The objects of this class are cloneable with this method.
CubicalComplex$clone(deep = FALSE)
deep
Whether to make a deep clone.
Pawel Dlotko
Other data structures for cell complexes:
PeriodicCubicalComplex
,
SimplexTree
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc
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()
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()
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$dimension()
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$num_simplices()
n <- 10
X <- cbind(seq(0, 1, len = n), seq(0, 1, len = n))
cc <- CubicalComplex$new(top_dimensional_cells = X)
cc$persistence()
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)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.