adding type to reserve! in most solvers#263
Open
nestordemeure wants to merge 8 commits intoJuliaLinearAlgebra:masterfrom
nestordemeure:patch-1
Open
adding type to reserve! in most solvers#263nestordemeure wants to merge 8 commits intoJuliaLinearAlgebra:masterfrom nestordemeure:patch-1
nestordemeure wants to merge 8 commits intoJuliaLinearAlgebra:masterfrom
nestordemeure:patch-1
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Member
|
Out of curiosity, how did you run into this? |
Author
|
I did tests with an instrumented type that does not implement silent conversion to Float64 to avoid bugs due to unseen conversions. |
Member
|
Bump. This looks like a fix that would be nice to have in IterativeSolvers.jl. |
Member
|
What do you think of this, @haampie? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, ...withreserve!(typeof(tol), history, ....I did not modify
lsqr.jl,lsmr.jlandsvdl.jlas 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)