Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARPACK error in eigs #424

Closed
timholy opened this issue May 1, 2017 · 7 comments
Closed

ARPACK error in eigs #424

timholy opened this issue May 1, 2017 · 7 comments

Comments

@timholy
Copy link
Member

timholy commented May 1, 2017

julia> eigs(ones(2,2), eye(2,2); nev=1)
ERROR: Base.LinAlg.ARPACKException("unspecified ARPACK error: -9999")
Stacktrace:
 [1] aupd_wrapper(::Type{T} where T, ::Base.LinAlg.#matvecA!#98{Array{Float64,2}}, ::Base.LinAlg.##95#102{Array{Float64,2}}, ::Base.LinAlg.##96#103, ::Int64, ::Bool, ::Bool, ::String, ::Int64, ::Int64, ::String, ::Float64, ::Int64, ::Int64, ::Array{Float64,1}) at ./linalg/arpack.jl:52
 [2] #_eigs#91(::Int64, ::Int64, ::Symbol, ::Float64, ::Int64, ::Void, ::Array{Float64,1}, ::Bool, ::Base.LinAlg.#_eigs, ::Array{Float64,2}, ::Array{Float64,2}) at ./linalg/arnoldi.jl:285
 [3] (::Base.LinAlg.#kw##_eigs)(::Array{Any,1}, ::Base.LinAlg.#_eigs, ::Array{Float64,2}, ::Array{Float64,2}) at ./<missing>:0
 [4] #eigs#85(::Array{Any,1}, ::Function, ::Array{Float64,2}, ::Array{Float64,2}) at ./linalg/arnoldi.jl:93
 [5] (::Base.LinAlg.#kw##eigs)(::Array{Any,1}, ::Base.LinAlg.#eigs, ::Array{Float64,2}, ::Array{Float64,2}) at ./<missing>:0
@tkelman
Copy link

tkelman commented May 1, 2017

Did this start happening recently?

@timholy
Copy link
Member Author

timholy commented May 1, 2017

Happens on 0.5 too.

@stevengj
Copy link
Member

stevengj commented May 1, 2017

It doesn't like 2x2 matrices:

julia> eigs(randn(2,2), eye(2,2); nev=1)
ERROR: ArgumentError: input matrix A is too small. Use eigfact instead.
Stacktrace:
 [1] #_eigs#91(::Int64, ::Int64, ::Symbol, ::Float64, ::Int64, ::Void, ::Array{Float64,1}, ::Bool, ::Base.LinAlg.#_eigs, ::Array{Float64,2}, ::Array{Float64,2}) at ./linalg/arnoldi.jl:184
 [2] (::Base.LinAlg.#kw##_eigs)(::Array{Any,1}, ::Base.LinAlg.#_eigs, ::Array{Float64,2}, ::Array{Float64,2}) at ./<missing>:0
 [3] #eigs#85(::Array{Any,1}, ::Function, ::Array{Float64,2}, ::Array{Float64,2}) at ./linalg/arnoldi.jl:93
 [4] (::Base.LinAlg.#kw##eigs)(::Array{Any,1}, ::Base.LinAlg.#eigs, ::Array{Float64,2}, ::Array{Float64,2}) at ./<missing>:0

Not sure why ones(2,2) produced a different error.

@stevengj
Copy link
Member

stevengj commented May 1, 2017

(In a quick benchmark, it seems that for anything smaller than 20x20 we'd be better off calling eigfact internally anyway.)

@ViralBShah
Copy link
Member

IIRC ARPACK's input doesn't quite work out for these tiny matrices. We should probably just discourage it's use on the small ones. 20x20 seems like a good threshold.

@andreasnoack
Copy link
Member

andreasnoack commented May 3, 2017

It can be reproduced for much larger matrices, e.g.

julia> LinAlg.eigs(ones(2000,2000), eye(2000); nev=1)
ERROR: LinAlg.ARPACKException("unspecified ARPACK error: -9999")
Stacktrace:
 [1] aupd_wrapper(::Type{T} where T, ::LinAlg.#matvecA!#98{Array{Float64,2}}, ::LinAlg.##95#102{Array{Float64,2}}, ::LinAlg.##96#103, ::Int64, ::Bool, ::Bool, ::String, ::Int64, ::Int64, ::String, ::Float64, ::Int64, ::Int64, ::Array{Float64,1}) at /Users/andreasnoack/julia-dev/base/linalg/arpack.jl:53
 [2] #_eigs#91(::Int64, ::Int64, ::Symbol, ::Float64, ::Int64, ::Void, ::Array{Float64,1}, ::Bool, ::LinAlg.#_eigs, ::Array{Float64,2}, ::Array{Float64,2}) at /Users/andreasnoack/julia-dev/base/linalg/arnoldi.jl:286
 [3] (::LinAlg.#kw##_eigs)(::Array{Any,1}, ::LinAlg.#_eigs, ::Array{Float64,2}, ::Array{Float64,2}) at ./<missing>:0
 [4] #eigs#85(::Array{Any,1}, ::Function, ::Array{Float64,2}, ::Array{Float64,2}) at /Users/andreasnoack/julia-dev/base/linalg/arnoldi.jl:93
 [5] (::LinAlg.#kw##eigs)(::Array{Any,1}, ::LinAlg.#eigs, ::Array{Float64,2}, ::Array{Float64,2}) at ./<missing>:0

but it is still looks like a corner of a corner case since it seems to require that A has a zero eigenvalues and that it is a generalized problem with B=eye(n)*α for some α. The slighest deviation makes the issue go away. E.g. all these work

julia> eigs(ones(2,2), nev = 1)
([2.0], [0.707107; 0.707107], 1, 1, 2, [0.0, 0.0])

julia> eigs(ones(2,2) + eps()*randn(2,2), eye(2), nev = 1)
([2.0], [0.707107; 0.707107], 1, 1, 3, [0.0, 0.0])

julia> eigs(ones(2,2), diagm([1.0, nextfloat(1.0)]), nev = 1)
([2.0], [0.707107; 0.707107], 1, 1, 5, [0.0, 0.0])

So it is probably an issue with ARPACK. I think the right fix is to fix #354.

@andreasnoack
Copy link
Member

Actually, it is a duplicate of #354

@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants