"ARPACKException: unspecified ARPACK error" when doing SVD of sparse matrix

#1

I get the error ARPACKException: unspecified ARPACK error: when trying to find the SVD of a sparsematrix tildeK.

SVD = svds(tildeK, nsv=2)[1];
ERROR: ARPACKException: unspecified ARPACK error: 1
Stacktrace:
[1] aupd_wrapper(::Type, ::getfield(Arpack, Symbol("#matvecA!#24")){Arpack.AtA_or_AAt{Float64,SparseMatrixCSC{Float64,Int64}}}, ::getfield(Arpack, Symbol("##18#25")), ::getfield(Arpack, Symbol("##19#26")), ::Int64, ::Bool, ::Bool, ::String, ::Int64, ::Int64, ::String, ::Float64, ::Int64, ::Int64, ::Array{Float64,1}) at /home/dass/.julia/packages/Arpack/UiiMc/src/libarpack.jl:49
[2] #_eigs#17(::Int64, ::Int64, ::Symbol, ::Float64, ::Int64, ::Nothing, ::Array{Float64,1}, ::Bool, ::typeof(Arpack._eigs), ::Arpack.AtA_or_AAt{Float64,SparseMatrixCSC{Float64,Int64}}, ::UniformScaling{Bool}) at /home/dass/.julia/packages/Arpack/UiiMc/src/Arpack.jl:198
[3] #_eigs at ./none:0 [inlined]
[4] #eigs#10 at /home/dass/.julia/packages/Arpack/UiiMc/src/Arpack.jl:63 [inlined]
[5] #eigs at ./none:0 [inlined]
[6] #_svds#37(::Int64, ::Bool, ::Float64, ::Int64, ::Int64, ::Array{Float64,1}, ::Function, ::SparseMatrixCSC{Float64,Int64}) at /home/dass/.julia/packages/Arpack/UiiMc/src/Arpack.jl:325
[7] (::getfield(Arpack, Symbol("#kw##svds")))(::NamedTuple{(:nsv,),Tuple{Int64}}, ::typeof(svds), ::SparseMatrixCSC{Float64,Int64}) at ./none:0
[8] top-level scope at none:0

#2

Are you able to post code to generate the matrix tildeK and thereby create a MWE? Also, which version of julia are you on? svds(tildeK, nsv=2)[1]; works fine for me on Linux, julia 1.1, Arpack.jl v0.3.0 using a random 100 X 100 real SPD sparse matrix.

Edit: I’m not too familiar with Arpack itself or Arpack.jl. You might want to double check that your matrix type is supported.

#3

I am on v1.1.0. tildeK is a sparse square matrix of size 70000, with about 8 entries in each row. Thus is it is very very sparse and there is no danger of running out of RAM. It is difficult to describe the construction of tildeK, it is built from a Gaussian kernel on a data-set.

If I could know what the error code means, I could figure out what is wrong. The error message is too cryptic at the moment.

But it seems to be a deficiency in the Julia SVD algorithm. tildeK is very sparse and very close to an identity matrix. The number of singular pairs I am asking for is also very low (2).

#4

Also, Arpack seems to be the only package to perform the svd of a sparse matrix, isn’t it ? The svd method from the LinearAlgebra package doesn’t work.

julia> SVD = LinearAlgebra.svd(tildeK, nsv=2);
ERROR: MethodError: no method matching svd(::SparseMatrixCSC{Float64,Int64}; nsv=2)
Closest candidates are:
svd(::BitArray{2}) at /sware/build/Building/julia/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/bitarray.jl:90 got unsupported keyword argument “nsv”
svd(::LinearAlgebra.AbstractTriangular) at /sware/build/Building/julia/usr/share/julia/stdlib/v1.1/LinearAlgebra/src/triangular.jl:2471 got unsupported keyword argument “nsv” …

#5

Maybe KrylovKit.jl can help?

1 Like
#6

Thank you for the suggestion. I am testing it.