Created attachment 513 [details]
Improved GMRES Implementation
- Termination based on relative error quantity (like e.g. ConjugateGradient)
- Document termination criterion
- Properly set info() and error() fields after call to solve()
- Rename set_restart() -> setRestart() and get_restart() -> restart() to follow the Eigen naming convention
- More verbous in-code documentation
- Use x = 0 as default initial guess as documented
- Avoid excessive memory use if user specifies large restart parameter
Thank you for the patch.
However, it is based on eigen3.2, while several fixes have already been made in the devel branch. In particular, the following changeset should be considered and merged:
Moreover, the calls to std::min should be protected with parenthesis: (std::min)(...)
The differences between 3.2 and the default branches are:
- Some changes to gmres() (i.e., the actual algorithm) by Kolja Brix:
- Convergence check based on residual
- Bug fixes
- Some changes to how this algorithm is called by Gael Guennebaud
(You're invited to verify the above, I am not yet much experienced with version control.)
Also my implementation uses a residual-based convergence check, and the bug fixes should be obsolete because I largely reimplemented the gmres() function. The changes by Kolja are thus covered.
Merging your changes should be fairly easy. I can do it sometime if there is hope that these changes will make it into the library.
Alright, so it seems that one of the main difference is that one version use the following threshold:
tol_error * precond.solve(rhs - mat*x).norm()
while yours is:
tol_error * precond.solve(rhs).norm()
To find which is one is correct, could you elaborate on what "w(k)" is supposed to represent when being compared to the threshold for convergence? Is it supposed to be equal to preconditioned residual precond.solve(rhs - mat*x).norm() where x is the current solution?
Exactly. A detailed explanation is given in Saad's "Iterative Methods for Sparse Linear Systems", Section 6.5.3, and the claim is explicitly formulated in Proposition 6.9 (3.). The w in the code equals g in the notation of Saad.
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/926.