Skip to contents

Computes the Fréchet mean (Karcher mean) of a list of Symmetric Positive-Definite (SPD) matrices. This function can use either the Affine-Invariant Riemannian Metric (AIRM) via the `shapes` package (if available and `metric="airm"`), or an iterative algorithm based on the Log-Euclidean metric (`metric="logeuclidean"`).

Usage

frechet_mean_spd(
  S_list,
  metric = c("logeuclidean", "airm"),
  regularize_epsilon = 1e-06,
  max_iter = 50,
  tol = 1e-05,
  step_size = 0.5,
  init_method = c("euclidean", "first"),
  verbose = FALSE
)

Arguments

S_list

A list of SPD matrices.

metric

Character string, either `"logeuclidean"` (default) or `"airm"`.

regularize_epsilon

Epsilon for regularization. Default 1e-6.

max_iter

Maximum number of iterations for Log-Euclidean algorithm. Default 50.

tol

Tolerance for convergence for Log-Euclidean algorithm (Frobenius norm of the mean tangent vector). Default 1e-5.

step_size

Step size for the gradient descent in Log-Euclidean. Default 0.5.

init_method

For Log-Euclidean, method to initialize the mean: `"euclidean"` (Euclidean mean of matrices) or `"first"` (first matrix in list). Default `"euclidean"`.

verbose

Logical, if TRUE, prints iteration info for Log-Euclidean. Default FALSE.

Value

The Fréchet mean (an SPD matrix).