calculate_homology: Calculate Persistent Homology of a Point Cloud

Description Usage Arguments Details Value Examples

View source: R/calculate.R

Description

Calculates the persistent homology of a point cloud, as represented by a Vietoris-Rips complex. This function is an R wrapper for Ulrich Bauer's Ripser C++ library for calculating persistent homology. For more information on the C++ library, see <https://github.com/Ripser/ripser>.

Usage

1
2
calculate_homology(mat, dim = 1, threshold = -1, p = 2L,
  format = "cloud", standardize = FALSE, return_df = FALSE)

Arguments

mat

numeric matrix containing point cloud or distance matrix

dim

maximum dimension of features to calculate

threshold

maximum diameter for computation of Vietoris-Rips complexes

p

number of the prime field Z/pZ to compute the homology over

format

format of 'mat', either "cloud" for point cloud or "distmat" for distance matrix

standardize

boolean determining whether point cloud size should be standardized

return_df

defaults to 'FALSE', returning a matrix; if 'TRUE', returns a data frame

Details

The 'mat' parameter should be a numeric matrix with each row corresponding to a single point, and each column corresponding to a single dimension. Thus, if 'mat' has 50 rows and 5 columns, it represents a point cloud with 50 points in 5 dimensions. The 'dim' parameter should be a positive integer. Alternatively, the 'mat' parameter could be a distance matrix (upper triangular half is ignored); note: 'format' should be specified as "ldm".

Value

3-column matrix or data frame, with each row representing a TDA feature

Examples

1
2
3
4
5
6
7
# create a 2-d point cloud of a circle (100 points)
num.pts <- 100
rand.angle <- runif(num.pts, 0, 2*pi)
pt.cloud <- cbind(cos(rand.angle), sin(rand.angle))

# calculate persistent homology (num.pts by 3 numeric matrix)
pers.hom <- calculate_homology(pt.cloud)

rrrlw/TDAstats documentation built on Nov. 24, 2021, 3:53 a.m.