
# gradient of the distance functions first argument

The gradient of $f(x) = \tfrac{1}{p} d^p(x,y)$ for a fixed value $y\in\M$ and $p\geq1$, with standard $p=2$. This function returns the gradient

if $x\neq y$ and the element $\eta=0\in T_x\M$ form the subgradient else. For details see [1].

### Matlab Documentation

1
2
3
4
5
6
7
8
% gradDistance(M,x,y,p) gradient of f(x) = 1/p d^p(x,y)for fixed y in M.
%
% INPUT
%  M   : a manfiold
% x,y  : two points on a manifold
%  p   : (2) exponent of the distance function
% ---
% MVIRT | R. Bergmann | 2018-01-22


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