Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding type to reserve! in most solvers #263

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

adding type to reserve! in most solvers #263

wants to merge 8 commits into from

Conversation

nestordemeure
Copy link

When storing a log, solvers reserve memory with reserve!. By default no type information is passed to this method which, then, converts the history into Float64.
This is not the expected behaviour when using non traditional types (for instrumentation purpose) and can lead to problems if their silent convertion into Float64 is not detected by the programmer.

Thus I replaced several occurences of reserve!(history, ... with reserve!(typeof(tol), history, ....

I did not modify lsqr.jl, lsmr.jl and svdl.jl as the modification was less straightforward but they should probably be modified in the same way.

(overall I think that reserve! should always stipulate the expected type to avoid regression on this issue)

@codecov-io
Copy link

Codecov Report

Merging #263 into master will decrease coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #263      +/-   ##
==========================================
- Coverage   90.61%   90.56%   -0.06%     
==========================================
  Files          18       18              
  Lines        1130     1124       -6     
==========================================
- Hits         1024     1018       -6     
  Misses        106      106
Impacted Files Coverage Δ
src/qmr.jl 90.56% <100%> (ø) ⬆️
src/minres.jl 95.74% <100%> (ø) ⬆️
src/bicgstabl.jl 94.73% <100%> (ø) ⬆️
src/simple.jl 85.71% <100%> (ø) ⬆️
src/chebyshev.jl 93.75% <100%> (ø) ⬆️
src/cg.jl 95% <100%> (-0.35%) ⬇️
src/idrs.jl 91.93% <100%> (ø) ⬆️
src/gmres.jl 93.22% <100%> (ø) ⬆️
src/lsqr.jl 97.5% <0%> (-0.18%) ⬇️

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 e090fc6...59c25db. Read the comment docs.

@mschauer
Copy link
Member

mschauer commented Feb 2, 2020

Out of curiosity, how did you run into this?

@nestordemeure
Copy link
Author

I did tests with an instrumented type that does not implement silent conversion to Float64 to avoid bugs due to unseen conversions.

@ranocha
Copy link
Member

ranocha commented Dec 7, 2020

Bump. This looks like a fix that would be nice to have in IterativeSolvers.jl.

@ranocha
Copy link
Member

ranocha commented Dec 16, 2020

What do you think of this, @haampie?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants