ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Minres solver

Open MarcelKoch opened this issue 3 years ago • 8 comments

This PR will add a Minres solver for symmetric/hermitian indefinite matrices. The implementation is based in the book 'Iterative Methods for Solving Linear Systems' (Ch. 8) by Anne Greenbaum (DOI: https://doi.org/10.1137/1.9781611970937). It uses the common kernel interface to define kernels.

One uncertainty for me is the computation of the residual norm approximation. I'm using the approach from Iterative Methods for Singular Linear Equations and Least-Squares Problems, but somehow this does not define the initial value for the used recursion. The three possible values are beta = sqrt(<r, z>), ||r|| or ||z||. I'm currently using ||z||, since I could also find that used by petsc. I've compared these three in matlab for smaller matrices, and the difference between these does not seem to matter.

Todo:

  • [x] wait until #973 is merged and update to that.

MarcelKoch avatar Feb 22 '22 14:02 MarcelKoch

format-rebase!

MarcelKoch avatar Feb 22 '22 16:02 MarcelKoch

Error: Rebase failed, see the related Action for details

ginkgo-bot avatar Feb 22 '22 16:02 ginkgo-bot

format!

MarcelKoch avatar Feb 22 '22 16:02 MarcelKoch

Codecov Report

Attention: 43 lines in your changes are missing coverage. Please review.

Comparison is base (1e268ff) 91.03% compared to head (6a991bc) 91.72%. Report is 4 commits behind head on develop.

:exclamation: Current head 6a991bc differs from pull request most recent head 7e34ec9. Consider uploading reports for the commit 7e34ec9 to get more accurate results

Files Patch % Lines
core/solver/minres.cpp 73.56% 23 Missing :warning:
common/unified/solver/minres_kernels.cpp 83.72% 7 Missing :warning:
include/ginkgo/core/solver/minres.hpp 64.28% 5 Missing :warning:
core/device_hooks/common_kernels.inc.cpp 0.00% 3 Missing :warning:
reference/test/solver/minres_kernels.cpp 97.72% 3 Missing :warning:
reference/solver/minres_kernels.cpp 96.42% 2 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #975      +/-   ##
===========================================
+ Coverage    91.03%   91.72%   +0.69%     
===========================================
  Files          697      503     -194     
  Lines        56724    43056   -13668     
===========================================
- Hits         51639    39494   -12145     
+ Misses        5085     3562    -1523     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 23 '22 21:02 codecov[bot]

I've realized that there are issues if the jacobi preconditioner is used for matrices with negative diagonal elements. I need to further investigate this, so I will put the PR back to WIP.

MarcelKoch avatar May 19 '22 09:05 MarcelKoch

Error: The following files need to be formatted:

test/solver/minres_kernels.cpp

You can find a formatting patch under Artifacts here or run format! if you have write access to Ginkgo

ginkgo-bot avatar May 19 '22 09:05 ginkgo-bot

Note: This PR changes the Ginkgo ABI:

Functions changes summary: 0 Removed, 0 Changed, 792 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

For details check the full ABI diff under Artifacts here

ginkgo-bot avatar May 19 '22 09:05 ginkgo-bot

I've realized that there are issues if the jacobi preconditioner is used for matrices with negative diagonal elements. I need to further investigate this, so I will put the PR back to WIP.

In general, Jacobi is not supposed to work for indefinite systems. Is the system indefinite? If so, this may not be an issue. If the matrix is diagonal dominant, but has both negative and positive diagonal elements, I guess there's a high chance it's indefinite.

Slaedr avatar May 31 '22 21:05 Slaedr