| calculate_homology | R Documentation |
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>.
calculate_homology(
mat,
dim = 1,
threshold = -1,
p = 2L,
format = "cloud",
standardize = FALSE,
return_df = FALSE
)
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 |
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".
3-column matrix or data frame, with each row representing a TDA feature
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.