knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
ripserr ports the Ripser and Cubical Ripser persistent homology calculation engines from C++ via Rcpp. It can be used as a convenient and rapid calculation tool in topological data analysis pipelines.
# install development version devtools::install_github("rrrlw/ripserr") # install from CRAN (not available yet) # install.packages("ripserr")
Ripser (Vietoris-Rips complex) can be used as follows for data with dimension greater than or equal to 2.
# load ripserr library("ripserr") set.seed(42) SIZE <- 100 # 2-dimensional example dataset2 <- rnorm(SIZE * 2) dim(dataset2) <- c(SIZE, 2) vr_phom2 <- vietoris_rips(dataset2) head(vr_phom2) tail(vr_phom2) # 3-dimensional example dataset3 <- rnorm(SIZE * 3) dim(dataset3) <- c(SIZE, 3) vr_phom3 <- vietoris_rips(dataset3, max_dim = 2) # default: max_dim = 1 head(vr_phom3) tail(vr_phom3)
Cubical Ripser (cubical complex) can be used as follows for data with dimension equal to 2, 3, or 4.
# load ripserr library("ripserr") set.seed(42) SIZE <- 10 # 2-dimensional example dataset2 <- rnorm(SIZE ^ 2) dim(dataset2) <- rep(SIZE, 2) cub_phom2 <- cubical(dataset2) head(cub_phom2) tail(cub_phom2) # 3-dimensional example dataset3 <- rnorm(SIZE ^ 3) dim(dataset3) <- rep(SIZE, 3) cub_phom3 <- cubical(dataset3) head(cub_phom3) tail(cub_phom3) # 4-dimensional example dataset4 <- rnorm(SIZE ^ 4) dim(dataset4) <- rep(SIZE, 4) cub_phom4 <- cubical(dataset4) head(cub_phom4) tail(cub_phom4)
vietoris_rips
).cubical
).If you use the ripserr package in your work, please consider citing the following (based on use):
To contribute to ripserr, you can create issues for any bugs/suggestions on the issues page. You can also fork the ripserr repository and create pull requests to add useful features.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.