Skip to contents

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

Author

Pawel Dlotko

Super class

rgudhi::PythonClass -> CubicalComplex

Methods

Inherited 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 to NULL which uses the Python class constructor instead.

Returns

A new CubicalComplex object.


Method betti_numbers()

This function returns the Betti numbers of the complex.

Usage

CubicalComplex$betti_numbers()

Details

The $betti_numbers() method always returns [1, 0, 0, ...] as infinity filtration cubes are not removed from the complex.

Returns

An integer vector storing the Betti numbers.


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.

Usage

CubicalComplex$cofaces_of_persistence_pairs()

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.

Usage

CubicalComplex$compute_persistence(
  homology_coeff_field = 11,
  min_persistence = 0
)

Arguments

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.

Returns

The updated CubicalComplex class itself invisibly.


Method dimension()

This function returns the dimension of the complex.

Usage

CubicalComplex$dimension()

Returns

An integer value giving the complex dimension.


Method num_simplices()

This function returns the number of all cubes in the complex.

Usage

CubicalComplex$num_simplices()

Returns

An integer value giving the number of all cubes in the complex.


Method persistence()

This function computes and returns the persistence of the complex.

Usage

CubicalComplex$persistence(homology_coeff_field = 11, min_persistence = 0)

Arguments

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.

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.

Usage

CubicalComplex$persistence_intervals_in_dimension(dimension)

Arguments

dimension

An integer value specifying the desired dimension.

Returns

A tibble storing the persistence intervals by row.


Method persistent_betti_numbers()

This function returns the persistent Betti numbers of the complex.

Usage

CubicalComplex$persistent_betti_numbers(from_value, to_value)

Arguments

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).

Returns

An integer vector storing the persistent Betti numbers.


Method clone()

The objects of this class are cloneable with this method.

Usage

CubicalComplex$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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)
}