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

svds StackOverfowError for Float16 matrices

Open zgornel opened this issue 6 years ago • 1 comments

svds throws a StackOverflowError on Julia 1.2-DEV.172 when applied to Float16 matrices, sparse or not (could not test on Julia 1.0):

julia> svds(Float16[1 2 3; 4 5 6;7 8 9], nsv=2)
ERROR: StackOverflowError:
Stacktrace:
 [1] (::getfield(Arpack, Symbol("#kw##svds")))(::NamedTuple{(:nsv,),Tuple{Int64}}, ::typeof(svds), ::Array{Float16,2}) at ./none:0
 [2] #svds#35(::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol},NamedTuple{(:nsv,),Tuple{Int64}}}, ::Function, ::Array{Float16,2}) at /home/zgornel/.julia/packages/Arpack/UiiMc/src/Arpack.jl:263
 ... (the last 2 lines are repeated 37122 more times)
 [74247] (::getfield(Arpack, Symbol("#kw##svds")))(::NamedTuple{(:nsv,),Tuple{Int64}}, ::typeof(svds), ::Array{Float16,2}) at ./none:0

For Float32 and Float64 works as expected. The regular svd returns Float32 results for Float16 matrices, I may be missing something here...

ulia> u, s, v = svd(Float16[1 2 3; 4 5 6;7 8 9])
SVD{Float32,Float32,Array{Float32,2}}(Float32[-0.214837 0.88723 0.408248; -0.520587 0.249644 -0.816496; -0.826337 -0.387943 0.408248], Float32[16.8481, 1.06837, 2.37212e-7], Float32[-0.479671 -0.572368 -0.665064; -0.776691 -0.0756864 0.625318; -0.408248 0.816497 -0.408248])

zgornel avatar Jan 18 '19 18:01 zgornel

The underlying Arpack library does not support Float16. We could give a better error message.

ViralBShah avatar Oct 11 '21 20:10 ViralBShah