cubical: Calculating Persistent Homology via a Cubical Complex

View source: R/cubical.R

cubicalR Documentation

Calculating Persistent Homology via a Cubical Complex

Description

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.

Usage

cubical(dataset, ...)

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

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

Arguments

dataset

object on which to calculate persistent homology

...

other relevant parameters

threshold

maximum simplicial complex diameter to explore

method

either "lj" (for Link Join) or "cp" (for Compute Pairs); see Kaji et al. (2020) arXiv:2005.12692 for details

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.

Value

PHom object

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)

rrrlw/ripserr documentation built on July 12, 2022, 11:13 a.m.