Skip to contents

Currently computes the Fréchet mean associated with the 2-Wasserstein distance, a.k.a Wasserstein barycenter.

Usage

# S3 method for persistence_diagram_sample
mean(x, initial_center = NULL, verbose = FALSE, ...)

Arguments

x

An object of class persistence_diagram_sample.

initial_center

Either an integer value specifying the index of a persistence diagram in the input list to be used as initial center or an object of class persistence_diagram to be used as initial center. Defaults to NULL, which randomly chooses a center from the input list.

verbose

A boolean specifying whether information should be displayed into the console. Defaults to FALSE.

...

Further arguments passed to or from other methods.

Value

An object of class persistence_diagram.

Examples

if (FALSE) { # reticulate::py_module_available("gudhi") && requireNamespace("tibble",      quietly = TRUE)
dg1 <- as_persistence_diagram(tibble::tibble(birth = 0.2, death = 0.5))
dg2 <- as_persistence_diagram(tibble::tibble(birth = 0.2, death = 0.7))
dg3 <- as_persistence_diagram(tibble::tibble(
  birth = c(0.3, 0.7, 0.2),
  death = c(0.6, 0.8, 0.3)
))
pdset <- as_persistence_diagram_sample(list(dg1, dg2, dg3))
bary <- mean(pdset)
}