This function is an R wrapper for the CubicalRipser C++ library to calculate persistent homology. For more information on the C++ library, see https://github.com/CubicalRipser. For more information on how objects of different classes are evaluated by cubical, read the Details section below.

cubical(dataset, ...)

# S3 method for array
cubical(dataset, threshold = 9999, method = "lj", ...)

# S3 method for matrix
cubical(dataset, ...)

Arguments

dataset object on which to calculate persistent homology other relevant parameters maximum simplicial complex diameter to explore either "lj" (for Link Join) or "cp" (for Compute Pairs); see Kaji et al. (2020) arXiv:2005.12692 for details

Value

PHom object

Details

cubical.array assumes dataset is a lattice, with each element containing the value of the lattice at the point represented by the indices of the element in the array.

cubical.matrix is redundant for versions of R at or after 4.0. For previous versions of R, in which objects with class matrix do not necessarily also have class array, dataset is converted to an array and persistent homology is then calculated using cubical.array.

Examples


# 2-dim example
dataset <- rnorm(10 ^ 2)
dim(dataset) <- rep(10, 2)
cubical_hom2 <- cubical(dataset)

# 3-dim example
dataset <- rnorm(8 ^ 3)
dim(dataset) <- rep(8, 3)
cubical_hom3 <- cubical(dataset)

# 4-dim example
dataset <- rnorm(5 ^ 4)
dim(dataset) <- rep(5, 4)