Hello,
Here is a question we get a lot: how can we use Manopt to minimize a nonsmooth cost function on a manifold like this (L1 cost):
h(X) = |g(X)| (absolute value)
where X is a point on a manifold (typically, a matrix), g : manifold -> reals, and h : manifold -> reals, where g is (sufficiently) smooth, but of course h isn't, because of the absolute value?
There is some research going on to develop Riemannian optimization algorithms for nonsmooth costs, but there is nothing for that in Manopt at this stage. (By all means, if you are developing such solvers yourself and you'd like to see them in Manopt, do let us know: there is a huge demand for it.)
Your best bet for now is to use a smooth approximation of h, which means you need to approximate the absolute value function.
f(x) = \sqrt{x^2 + \epsilon^2} - \epsilon.
As long as \epsilon is positive, this is perfectly smooth (C^\infty). For epsilon = 0, this is |x|.
So to get the gradient of your cost wrt the matrix X, you would use the chain rule for derivatives:
f : reals -> reals
g : matrices -> reals
h : matrices -> reals
h(X) = f(g(X))
Dh(X)[U] = f'(g(X)) Dg(X)[U]
hence the (Euclidean) gradients are given as follows:
grad h(X) = f'(g(X)) grad g(X)
with
f'(x) = x / \sqrt{x^2 + \epsilon^2} ( note that, as \epsilon -> 0, f'(x) -> sign(x) )
I hope this can help. Don't hesitate to comment in this topic for clarifications / alternative propositions / ...
Best,
Nicolas