ndarray-linalg
ndarray-linalg copied to clipboard
Gmres implementation
Hi,
Gmres implementation was on the todo list in #107, but has since been stalled. Here is a first draft I have created. It implements Gmres as an iterator, similar to the Arnoldi iteration. Currently, the iterator stops when (i) the maximum number of iterations is reached, (ii) the algorithm converges or (iii) the last Krylov vector is not linearly independent.
The new search vector y (x = x0 + Qy) is found via a least squares problem | g - R y |, where R is an upper triangular matrix. The update fails if solving the upper triangular system fails, which should not happen if all Krylov vectors are independent, since in this case the diagonal of R is non-zero.
It is still rough in some places and the method of preconditioning has not yet been tested. I am open to suggestions, especially about stopping the iterator.
Here is some explanation of the algorithm: https://github.com/preiter93/gmres/blob/master/doc/gmres.pdf
Todo
- [ ] Check preconditioning
- [ ] Relative residual vs absolute residual