Hi again,
I have done some progress in the last days in this issue by modifying `hessianspectrum`.
Unfortunately, I have some crazy weeks coming due to deadlines, so I will not be able to clean and contribute anything for a while. Yet, I think it will be useful to share some insight here so that we can discuss it:
- How to compute the Smallest Magnitude (SM) eigenvalues in the spectrum?
Well, first thing using `eigs` is we'll need to provide a function handle AFUN that provides A\X. That is, in our case:
* we need to compute the inverse `hess_vec_inv(u_vec)` of the vectorized Hessian operator `hess_vec(u_vec)`.
For that purpose we could use either a Manopt-based approach as that in `preconhessiansolve`,
or an iterative method for the linear (vectorized) problem `hess_vec(u_vec)=d_vec`.
This can be done e.g. with the symmetric LQ method, `symmlq` in Matlab,
which is similar to `pcg` but admits indefinite matrices (as the Hessian needs not to be positive definite).
One should be careful though about the zero eigenvalues of the vectorized Hessian operator during the inversion.
Then, once we have the inverse operator, calling `eigs` with 'SM' option would usually find first all those *n-dim* zero eigenvalues
due to the normal directions in the ambient space. A (simple?) solution to prevent this seems to be:
* to implement specific `vec` and `mat` operators that have the minimum dimensionality (that of the tangent space),
so that the vectorized domain parameterizes the range of the tangent space only. This way we avoid spurious zero eigenvalues.
Care should be taken of course of choosing `vec` so that it is an isometry of the original problem.
With these two approaches, we should be able to modify `hessianspectrum` so that it may receive two new arguments 'K' and 'SIGMA',
akin to `eigs`, defining the number of eigenvalues and compute and its type (usually either 'LM' or 'SM').
This is something which should be done correctly for legacy, but when done should provide a nice interface quite similar
to that of the standard `eigs` tool in Matlab.
On a different basis, I have also observed some interesting facts about the computation of the spectrum involvin a preconditioner:
- How to obtain a (simpler) `sqrtprecon`?
From the documentation (and the code at hessian spectrum) it is stablished that `sqrtprecon` should be an operator
such that `precon = sqrtprecon o sqrtprecon`. That is, the unique non-negative square root as defined
in Wikipedia.
That `sqrtprecon` operator should be defined from/to tangent space TxM.
I have tried to apply a more relaxed version of the square root so that `precon = sqrtprecon o (sqrtprecon)*`,
where * stands for the adjoint of the operator. This more general operator would `sqrtprecon` would be defined
from a (more generic) linear space to the tangent space TxM (opposite for the adjoint).
The good thing is that this version of `sqrtprecon` can be obtained more easily, e.g. through Cholesky decomposition
of the symmetric operator `precon`. Thus a composition of the type `sqrtprec_adj_vec(hess_vec(sqrtprec_vec(z_vec)))`
is still symmetric and efficient for finding the eigenvalues using `eigs`.
This seems to work at least in the cases I have tried with the Stiefel manifold,
although I have not been able to unify this general sqrtprecon and sqrprecon* decomposition
with the minimal vectorization approach to remove spurious eigenvalues.
This is because the composition `(sqrtprecon)* o Hess o sqrtprecon` is not directly from TxM to TxM,
but from some other intermediate domain the decomposition `sqrtprecon o (sqrtprecon)*` introduces,
making the search for an appropriate minimal `vec` operator in this case harder.
Well, it's difficult to compress everything, but I hope these hints will be useful to keep working on this
and discuss possible venues :)
I'm not an expert in most of the issues arising in here, so I would appreciate any theoretical or terminological correction :)
Best,
Jesus