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

# The manifold class

The Matlab class manifold represents a manifold in general and handles directly also everything as a product manifold using the vector and matrix features of Matlab.

All manifolds inherit from manifold, such that both the algorithms and several functions within the manifold are based on the following basic properties a child class should implement.

## Variables

AllDims
an cell array of : strings with the length equal to the length of ItemSize – for internal use, but must be initialized within the constructor.
Dimension
an integer specifying the dimension of the finite dimensional Riemannian manifold.
ItemSize
The information on size(x) when x is a single point on the manifold. note that data is always stored with the manifold dimensions first, so an array Xof n manifold points has size(X) = [ItemSize,n].
type
a String representing the manifold mainly in debug informations

## Abstract Functions

The following functions are the basic functions not only necessary for most algoeithms but also as the basis for forthcoming algorithms to base functions on these. If they are easy functions, they should be implemented within this class. In order to perform algorithms on images, these functions should always also be able to handle arbitrary sized arrays of manifold-points (see ItemSize above) and return the corresponding arrays.

dist(x,y)
distance function of two points (vectors of points) on a manifold, returns an array of the data dimensions.
dot(x,xi,nu)
inner product in $T_x\M$ of two tangent vectors $\xi,\nu\in T_x\M$.
exp(x,xi)
the exponential map at $x\in\M$ with direction $\xi\in T_x\M$ might optionally be extended by a further parameter $t\in\mathbb R$ to scale $\xi$ before applying the exponential map
log(x,y)
the logarithmic map (or inverse exponential); though defined only locally it should return something deterministic otherwise, i.e. choose one of the possible values if the logaithm is not unique.
parallelTransport(x,y,xi)
parallel transport a vector $\xi\in T_x\M$ from the tangent space of $x\in\M$ to the tangent space $T_y\M$ of $y\in\M$.

### Functions

The adjoint differential of the exponential map base point
 1 % nu = AdjDxExp(x,xi,eta) - Adjoint of the Derivative of Exp with

This function evaluates for $F(x)=\exp_x\xi$ with fixed $\xi\in T_x\M$ the adjoint differenital $D^*_xF(x)[\eta].$

more
The adjoint differential of the start point of a geodesic
 1 % AdjDxGeo(x,y,t,eta) Adjoint of the Derivative of geo(x,y,t) wrt x.

This function evaluates for $F(x)=\geo{x}{y}(t)$ with fixed $y\in\M$ and $t\in\mathbb R$ the adjoint differenital $D^*_xF(x)[\eta]$

more
The adjoint differential of the logarithmic map base point
 1 % nu = AdjDxLog(x,y,eta) - Adjoint of the Derivative of Log

This function evaluates for $F(x)=\log_xy$ with fixed $y\in\M$ the adjoint differenital $D^*_xF(x)[\eta].$

more
The adjoint differential of the exponential map
 1 % nu = AdjDxExp(x,xi,eta) - Adjoint of the Derivative of Exp with

This function evaluates for $F(\xi)=\exp_x\xi$ with fixed $x\in\M$ the adjoint differenital $D^*_xF(\xi)[\eta]$

more
The adjoint differential of the end point of a geodesic
 1 % AdjDyGeo(x,y,t,eta) - Adjoint of the Derivative of geo(x,y,t) wrt y.

This function evaluates for $F(y)=\geo{x}{y}(t)$ with fixed $x\in\M$ and $t\in\mathbb R$ the adjoint differenital $D^*_yF(y)[\eta].$

more
The adjoint differential of the logarithmic map base point
 1 % nu = AdjDxLog(x,y,eta) - Adjoint of the Derivative of Log

This function evaluates for $F(x)=\log_yx$ with fixed $y\in\M$ the adjoint differenital $D^*_xF(x)[\eta].$

more
Adjoint Jacobi field
 1 % AdjJacobiField(x,y,t,eta) - evaluate a adjoint of a Jacobi field

Evaluates the adjoint $J^*$ of the Jacobi field along the geodesic $\geo{x}{y}$ at $t$ with initial conditions $\eta$.

more
The differential of the exponential map base point
 1 % nu = AdjDxExp(x,xi,eta) - Derivative of Exp w.r.t. base point x

This function evaluates for $F(x)=\exp_x\xi$ with fixed $\xi\in T_x\M$ the differenital $D_xF(x)[\eta].$

more
The differential of the start point of a geodesic
 1 % xi = DxGeo(x,y,t,eta) - Compute the Derivative D_xGeo(t; x,y)[eta]

This function evaluates for $F(x)=\geo{x}{y}(t)$ with fixed $y\in\M$ and $t\in\mathbb R$ the differenital $D_xF(x)[\eta].$

more
The differential of the logarithmic map base point
 1 % nu = AdjDxExp(x,xi,eta) - Derivative of Exp w.r.t. base point x

This function evaluates for $F(x)=\log_xy$ with fixed $y\in\M$ the differenital $D_xF(x)[\eta].$

more
The differential of the exponential
 1 % nu = DxExp(x,xi,eta) - Derivative of Exp w.r.t. xi

This function evaluates for $F(\xi)=\exp_x\xi$ with fixed $x\in\M$ the differenital $D_\xi F(\xi)[\eta], \eta\in T_x\M.$

more
The differential of the end point of a geodesic
 1 % xi = DxGeo(x,y,t,eta) Derivative of the geodesic(x,y,t) wrt y.

This function evaluates for $F(y)=\geo{x}{y}(t)$ with fixed $x\in\M$ and $t\in\mathbb R$ the differenital $D_yF(y)[\eta].$

more
The differential of the logarithmic map
 1 % nu = DyLog(x,y,eta) - Adjoint of the Derivative of Log

This function evaluates for $F(x)=\log_yx$ with fixed $y\in\M$ the differenital $D_xF(x)[\eta].$

more
Jacobi field
 1 % xi = JacobiField(x,y,t,eta) - evaluate a Jacobi field

For the geodesic $\geo{x}{y}(t)$ to $y\in\M$ a Jacobi field $J\in\mathcal X(\geo{x}{y})$ is a smooth vector field along $\geo{x}{y}$ fulfilling the ODE

where $\frac{D}{\partial t}$ denotes the (partial) covariant derivative, $R\colon T\M\times T\M\times T\M \to T\M$ is the curvature tensor and $\Gamma\colon (-\varepsilon,\varepsilon)\times[0,1]\to\M$ is a geodesic variation, , i.e. for any $s\in%-\varepsilon,\varepsilon)$ the function $\Gamma(s,\cdot)$ is a geodesic; and we have $J=\tfrac{\partial\Gamma}{\partial s}\big|_{s=0}$.

This function evaluates certain special Jacobi fields given a weight function $\alpha_{k,c}(t)$, where $k\in\{1,\ldots,d\}$ refers to the index $k$ of the eigenvalue, $t\in(0,1)$ and $c=d_\M(x,y)$

more
Filter an image
 1 % filteredImage = filter(this,image,filter)

This function performs a convolution or filtering of an image by reinterpreting the weightde sum in the convolution as a Karcher mean. For a given filter $w_{i,j}$, $i,j=-n,\ldots,n$ this function computes

where $k,l$ adress a pixel of the $\M^{N\times M}$ image $x$ and one can specify boundary conditions (nearest, symmetric or periodic).

more
The geodesic
 1 % geo = geodesic(this,x,y)

Returns evaluations of the geodesic $\gamma_{x,y}\colon\mathbb R \to \M$, either equidistant at pts points (which is set to 100) by default. If t is given as a vector of evaluation poitns, this one dominates.

A point on the geodesic
 1 % geopoint(x,y,t) - Gives the point \gamma_{x,y}(t)

The function evaluates a geodesic $\gamma_{x,y}\colon\mathbb R \to\M$ at $t$, i.e. returns $\gamma_{x,y}(t)$ by using the exponential and logarithmic map. When the geodesic is not unique this function still returns a deterministic single value based on the choice of the logarithmic map. This also allows for evaluating the geodesic of an image pixelwise, i.e. if $x,y$ are images, we obtain a pixelwise evaluation.

The Riemannian center of mass
 1 % mean(x) calculates the m means of the input data x [.,m,n]

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

more
The Riemannian median
 1 % median(x) calculates the m medians of x ([.,m,n])

The Riemannian median can be defined similarly to the mean, the Riemannian center of mass. We compute for a matrix of m x n points m medians in parallel, each consisting of n points. The median of one such set $x_1,...,x_n\in\M$ is defined as a (not necessarily unique) minimizer of

more
The mid point on a geodesic
 1 % m = midPoint(x,z)

The function returns a mid point of the two input points. Since the logarithm is deterministic and returns a unique value, this function is also deterministic, though the mid point might not be unique.

more
Pole Ladder – approximate parallel transport
 1 % poleladder(this,x,y,xi) approximates parallel Transport

The pole ladder is a way to approximate the parallel transport $P_{x\to y}\xi$ of a tangent vector $\xi\in T_x\M$ to $T_y\M$ since the original function might be hard to compute. Schild’s ladder is given by the formula

more
Schild’s Ladder – approximate parallel transport
 1 % schildsladder(this,x,y,xi) approximates parallel Transport

Schild’s ladder is a way to approximate the parallel transport $P_{x\to y}\xi$ of a tangent vector $\xi\in T_x\M$ to $T_y\M$ since the original function might be hard to compute. Schild’s ladder is given by the formula

more
Variance
 1 % var(f) computes the empirical variance

Compute the variance of the data, i.e. the mean distance to the mean.

For given data $f\in\M^N$ let $\hat f$ denote the Riemannian center of mass. Then the variance is given by

more