$\DeclareMathOperator{\arccosh}{arccosh} \DeclareMathOperator*{\argmin}{arg\,min} \DeclareMathOperator{\Exp}{Exp} \newcommand{\geo}{\gamma_{\overset{\frown}{#1,#2}}} \newcommand{\geoS}{\gamma} \newcommand{\geoD}{\gamma_} \newcommand{\geoL}{\gamma(#2; #1)} \newcommand{\gradM}{\nabla_{\M}} \newcommand{\gradMComp}{\nabla_{\M,#1}} \newcommand{\Grid}{\mathcal G} \DeclareMathOperator{\Log}{Log} \newcommand{\M}{\mathcal M} \newcommand{\N}{\mathcal N} \newcommand{\mat}{\mathbf{#1}} \DeclareMathOperator{\prox}{prox} \newcommand{\PT}{\mathrm{PT}_{#1\to#2}#3} \newcommand{\R}{\mathbb R} \newcommand{\SPD}{\mathcal{P}(#1)} \DeclareMathOperator{\Tr}{Tr} \newcommand{\tT}{\mathrm{T}} \newcommand{\vect}{\mathbf{#1}}$

# The Riemannian center of mass

The Riemannian center of mass can be computed for a matrix of m x n points, which computed n means simultaneously of m points each. The mean of one such set $x_1,...,x_n\in\M$ is defined as a (not necessarily unique) minimizer of

For this implementation one can further compute a weighted mean, by introducing the summands $w_id_{\M}^2(x_i,x)$. The stopping criterion is a functional based on the currend iterate, the last iterate and the number of iterations, where usually a maximum iterations number and a minimial change (of $\varepsilon>0$) is used (see stopCritMaxIterEpsilonCreator).

The algorithm follows .

### Matlab Documentation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
% mean(x) calculates the m means of the input data x [.,m,n]
% with gradient descent algorithm. The implementation follows
%
% B. Afsari, Riemannian Lp center of mass: Existence,
%    uniqueness, and convexity,
%    Proc. AMS 139(2), pp.655-673, 2011.
%
% INPUT
%    x :  m x n Data points ([this.Itemsize,m,n]) to compute
%         m means of n points each, pp.
% OUTPUT
%    y :  m data points of the means calculated
%
% OPTIONAL
% 'Weights' : (1/n*ones([m,n]) 1xn or mxn weights for the mean
%            the first case uses the same weights for all means
% 'InitVal' : m Initial Data points for the gradient descent
% 'MaxIterations': maximal number of iterations
% 'Epsilon'      : change of bewteen to iterates to stop
%
% ---
% Manifold-valued Image Restoration Toolbox 1.0,
% J. Persch 2015-07-24 | R. Bergmann 2018-02-16


1. Afsari, B (2011). Riemannian $L^p$center of mass: Existence, uniqueness, and convexity. Proceedings of the American Mathematical Society. 139 655–73