IterativeSolvers.jl icon indicating copy to clipboard operation
IterativeSolvers.jl copied to clipboard

Return CGResult from cg and allow absolute tol

Open mohamed82008 opened this issue 6 years ago • 8 comments

This fixes #236. I also allowed passing absolute tolerance as opposed to just a relative one. Since it makes sense for the residual to be <= the tolerance, the absolute tolerance is the one that should be returned in the CGResult. And it would be weird if I pass tol = .. to cg and then I see a different tolerance printed in the result.

mohamed82008 avatar Jan 15 '19 09:01 mohamed82008

Codecov Report

Merging #238 into master will decrease coverage by 0.48%. The diff coverage is 30.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #238      +/-   ##
==========================================
- Coverage   56.03%   55.54%   -0.49%     
==========================================
  Files          17       17              
  Lines        1740     1757      +17     
==========================================
+ Hits          975      976       +1     
- Misses        765      781      +16
Impacted Files Coverage Δ
src/cg.jl 52.5% <30.76%> (-12.58%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 91cac26...8c03b4b. Read the comment docs.

codecov-io avatar Jan 15 '19 09:01 codecov-io

I believe this is ready for a first review.

mohamed82008 avatar Jan 15 '19 22:01 mohamed82008

How do you plan to deprecate tol? I think it'd be better to add an abs_tol and rel_tol, have tol default to nothing and throw a deprecation warning if tol is actually set.

(I came here because I wanted to use abs_tol in gmres for a inexact newton method, so I'd love if all methods got this abs_/rel_tol separation. Isn't base using abstol and reltol btw?)

pkofod avatar Jul 25 '19 19:07 pkofod

I don't mind getting rid of tol. Not big on the underscore either.

mohamed82008 avatar Jul 26 '19 17:07 mohamed82008

Good. Then I think introducing abstol and reltol and deprecating the tol keyword is the best way forward.

pkofod avatar Jul 31 '19 12:07 pkofod

bump

chriscoey avatar Aug 15 '19 17:08 chriscoey

I'm working on introducing keyword arguments abstol and reltol in #280 with a proper deprecation of tol. Once that's settled, this approach to change the return type would be nice to consider next.

ranocha avatar Dec 07 '20 10:12 ranocha

#280 is merged now

mschauer avatar Oct 29 '21 21:10 mschauer