JuliaLinearAlgebra / IterativeSolvers.jl

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

Fix DiagonalIndices when sparse matrix indices are not Int64. #233

Closed tkonolige closed 5 years ago

tkonolige commented 5 years ago

searchsortedfirst (used to get diagonal entries) requires its inputs to be Int64. When the sparse matrix passed to DiagonalIndices has a different type of indices, searchsortedfirst is not found. I've fixed this issue and added tests to cover this behavior.

codecov-io commented 5 years ago

Codecov Report

Merging #233 into master will increase coverage by 4.77%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #233      +/-   ##
==========================================
+ Coverage    51.2%   55.98%   +4.77%     
==========================================
  Files          17       17              
  Lines        1738     1738              
==========================================
+ Hits          890      973      +83     
+ Misses        848      765      -83
Impacted Files Coverage Δ
src/stationary_sparse.jl 72.65% <0%> (ø) :arrow_up:
src/svdl.jl 59.15% <0%> (+0.93%) :arrow_up:
src/lsqr.jl 35.89% <0%> (+5.12%) :arrow_up:
src/idrs.jl 58.94% <0%> (+5.26%) :arrow_up:
src/minres.jl 62.5% <0%> (+5.55%) :arrow_up:
src/bicgstabl.jl 52.94% <0%> (+5.88%) :arrow_up:
src/cg.jl 65.07% <0%> (+6.34%) :arrow_up:
src/lsmr.jl 32.62% <0%> (+7.09%) :arrow_up:
src/history.jl 75.3% <0%> (+11.11%) :arrow_up:
src/gmres.jl 69.62% <0%> (+12.65%) :arrow_up:
... and 3 more

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 ed66486...335900a. Read the comment docs.

haampie commented 5 years ago

Thanks for the observation and PR! :)

This seems like an overly restrictive signature in Base, so you might want to file an issue in https://github.com/JuliaLang/julia

Further it's best to work with Int (not Int64) since that picks the native integer type of the platform (either Int32 or Int64).

haampie commented 5 years ago

Thanks! New version is pending: https://github.com/JuliaLang/METADATA.jl/pull/20256