For data on a dimensional grid with this function comutes the gradient of the TV prior
with respect to all entries of , i.e. .
In order to compute the gradient , one has to take into account all summands, where appears, which are besides the summands over the neighborhood all summands, where is a forward neighbor, i.e. the following [1] we denote an inner sum by for . Then the gradient reads by [2] and the chain rule
for and
for , where we set a summand to the zero vector whenever the denominator is zero and obtain a subgradient in this case.
Optional Parameters
epsilon
 relax the TV (especially for by replacing any distance by and for each inner sum (over ) is relaxed to avoid subgradients in constant areas.
p
 denotes the outer coupling of the differences
weights
for each item of 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
% gradTV(M,x) compute the gradient of the manifold total variation
%
% INPUT
% M : a manifold
% x : data (size [manDims,dataDims])
%
% OPTIONAL
% 'p' : (p=1) compute TV with pnorm 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 epsilonrelaxed TV
% 'weights' : (ones(dataDims)) exclude certain data points from all
% gradient terms
%
% OUTPUT
% eta : the gradient
% 
% MVIRT, R. Bergmann, 20171208
See also
References

Bergmann, R, Fitschen, J H, Persch, J and Steidl, G (2017). Priors with coupled first and second order differences for manifoldvalued image processing
We generalize discrete variational models involving the infimal convolution (IC) of first and second order differences and the total generalized variation (TGV) to manifoldvalued images. We propose both extrinsic and intrinsic approaches. The extrinsic models are based on embedding the manifold into an Euclidean space of higher dimension with manifold constraints. An alternating direction methods of multipliers can be employed for finding the minimizers. However, the components within the extrinsic IC or TGV decompositions live in the embedding space which makes their interpretation difficult. Therefore we investigate two intrinsic approaches: for Lie groups, we employ the group action within the models; for more general manifolds our IC model is based on recently developed absolute second order differences on manifolds, while our TGV approach uses an approximation of the parallel transport by the pole ladder. For computing the minimizers of the intrinsic models we apply gradient descent algorithms. Numerical examples demonstrate that our approaches work well for certain manifolds.@online{BFPS17, author = {Bergmann, Ronny and Fitschen, Jan Henrik and Persch, Johannes and Steidl, Gabriele}, title = {Priors with coupled first and second order differences for manifoldvalued image processing}, year = {2017}, eprint = {1709.01343}, eprinttype = {arXiv} }

Afsari, B (2011). Riemannian \(L^p\)center of mass: Existence, uniqueness, and convexity. Proceedings of the American Mathematical Society. 139 655–73
@article{Af11, title = { {R}iemannian \({L}^p\) center of mass: Existence, uniqueness, and convexity}, author = {Afsari, B.}, journal = {Proceedings of the American Mathematical Society}, volume = {139}, number = {2}, pages = {655673}, year = {2011}, doi = {10.1090/S000299392010105415} }