JuliaLinearAlgebra / IterativeSolvers.jl

Iterative algorithms for solving linear systems, eigensystems, and singular value problems
MIT License
399 stars 105 forks source link

history is silently converted to Float64 #264

Open nestordemeure opened 4 years ago

nestordemeure commented 4 years ago

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.

I submited a PR which fixes the issue for most solver : https://github.com/JuliaMath/IterativeSolvers.jl/pull/263

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.