Skip to contents

Bundles everything the package needs to know about a manifold into a single object. manifold.dcov.test and choose_base_point only interact with the manifold through this object, so supporting a new manifold amounts to writing these functions (conventionally in a script R/manifold-<name>.R, with names ending in _<name>) and registering the resulting constructor in get_manifold. See manifold_torus for an example.

Usage

new_manifold(
  name,
  representation,
  contains,
  log_map,
  dist,
  is_valid,
  base_point
)

Arguments

name

Character string identifying the manifold, e.g. "torus".

representation

Character string describing how points of the manifold are represented as matrix rows (e.g. "[0,1)^d"); used in error messages.

contains

Function f(X) returning TRUE if every row of the matrix X is a point of the manifold in the expected representation, FALSE otherwise.

log_map

Function f(X, p) mapping each row of X to the tangent space at base point p via the logarithmic (inverse exponential) map. Must return a numeric matrix with one row per row of X.

dist

Function f(X, p) returning the numeric vector of geodesic distances between each row of X and the point p.

is_valid

Function f(X, p) returning TRUE if no row of X lies on the cut locus of p (where the log map is undefined), FALSE otherwise. It should stop with an error if p is malformed (e.g. wrong length).

base_point

Named list of base point selection methods. Each element is a function f(X, n_start, maxit, seed, ...) returning a list with elements p (the chosen base point) and convergence (an optimizer convergence code, or NA for non-iterative methods); arguments it does not need are absorbed by .... The first element is the default method. A data-centered method can be built from dist with the generic optimize_base_point.

Value

An object of class "manifold": a list holding the arguments above.

Examples

m <- manifold_torus()
m$name
#> [1] "torus"
names(m$base_point)
#> [1] "auto"     "optimize"