$\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}}$

# gradient of the TV prior

For data $x\colon\Grid\to\M$ on a $m$-dimensional grid $\Grid$ with $N_{\vect{k}} = \bigl\{\vect{l} : \vect{l}+\vect{e}_j,\ j\in\{1,\ldots,m\}\bigr\}\cap G$ this function comutes the gradient of the TV prior

with respect to all entries of $x$, i.e. $\gradM F\colon\Grid\to T\M$.

In order to compute the gradient $\gradMComp{x_{\vect{k}}}$, one has to take into account all summands, where $x_{\vect{k}}$ appears, which are besides the summands over the neighborhood $N_{\vect{k}}$ all summands, where $\vect{k}$ is a forward neighbor, i.e. the $N_{\vect{k}}^- = \bigl\{\vect{l} : \vect{l}-\vect{e}_j,\ j\in\{1,\ldots,m\}\bigr\}$ following  we denote an inner sum by $\omega_{\vect{k}} = \Bigl( \sum_{\vect{l}\in N_{\vect{k}}} d^p_{\M}(x_{\vect{k}},x_{\vect{l}}) \Bigr)^{\frac{1}{p}}$ for $p>1$. Then the gradient reads by  and the chain rule

for $p > 1$ and

for $p=1$, where we set a summand to the zero vector whenever the denominator is zero and obtain a subgradient in this case.

### Optional Parameters

epsilon $(0)$
relax the TV (especially for $p=1$ by replacing any distance by $\sqrt{ d^2(\cdot,\cdot)+\varepsilon^2 }$ and for $p>1$ each inner sum (over $N_{\vect{k}}$) is relaxed to avoid subgradients in constant areas.
p $(1)$
denotes the outer coupling of the differences
weights $(1)$ for each item of $x$
introduces a weight that is muliplied to any term, i.e. if weights is zero this the corresponding data item is ignored.

### Matlab Documentation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
%
% INPUT
%   M      :  a manifold
%   x      : data (size [manDims,dataDims])
%
% OPTIONAL
%   'p'       : (p=1) compute TV with p-norm coupling in the dimensions of
%               the data, i.e. anisotropic TV for p=1 and isotropic for p=2
%  'epsilon'  : compute the gradient of the epsilon-relaxed TV
%  'weights'  : (ones(dataDims)) exclude certain data points from all

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