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

LinearAlgebra: eigen decomposition of Symmetric Matrix containing NaNs never throws. It just runs forever. #38346

Closed
s-baumann opened this issue Nov 8, 2020 · 5 comments · Fixed by #38408
Labels
linear algebra Linear algebra

Comments

@s-baumann
Copy link

On my (Windows) PC the following runs forever without ever throwing or finishing. The error seems to come from inside LAPACK. The key elements seems to be that the matrix is Symmetric and contains a NaN.
using LinearAlgebra aa = [1 2 3; 2 NaN 4; 3 4 5] bb = Symmetric(aa) eigen(bb)

@s-baumann s-baumann changed the title eigen decomposition of Symmetric Matrix containing NaNs never throws. It just runs forever. LinearAlgebra: eigen decomposition of Symmetric Matrix containing NaNs never throws. It just runs forever. Nov 8, 2020
@s-baumann
Copy link
Author

using LinearAlgebra
aa = [1 2 3; 2 NaN 4; 3 4 5]
bb = Symmetric(aa)
eigen(bb)

@antoine-levitt
Copy link
Contributor

Can't reproduce here (using MKL). Probably an OpenBLAS issue.

@KlausC
Copy link
Contributor

KlausC commented Nov 8, 2020

Could reproduce on Linux. Produced the following stack trace, when interrupted:

eigen(bb)
^C^C^C^C^C^CWARNING: Force throwing a SIGINT
ERROR: InterruptException:
Stacktrace:
 [1] syevr!(jobz::Char, range::Char, uplo::Char, A::Matrix{Float64}, vl::Float64, vu::Float64, il::Int64, iu::Int64, abstol::Float64)
   @ LinearAlgebra.LAPACK /home/julia/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/lapack.jl:5055
 [2] #eigen!#95
   @ /home/julia/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/symmetric.jl:672 [inlined]
 [3] #eigen#96
   @ /home/julia/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/symmetric.jl:677 [inlined]
 [4] eigen(A::Symmetric{Float64, Matrix{Float64}})
   @ LinearAlgebra /home/julia/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/symmetric.jl:675
 [5] top-level scope
   @ REPL[5]:1

There seems missing a call to ckfinite or analogous in syevr!, as can be seen here:

julia> eigen(aa)
ERROR: ArgumentError: matrix contains Infs or NaNs
Stacktrace:
 [1] chkfinite(A::Matrix{Float64})
   @ LinearAlgebra.LAPACK /home/julia/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/lapack.jl:92
 [2] geevx!(balanc::Char, jobvl::Char, jobvr::Char, sense::Char, A::Matrix{Float64})
   @ LinearAlgebra.LAPACK /home/julia/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/lapack.jl:2025
 [3] eigen!(A::Matrix{Float64}; permute::Bool, scale::Bool, sortby::typeof(LinearAlgebra.eigsortby))

@s-baumann
Copy link
Author

This is also a problem with Hermitian matrices. No issue with Diagonal matrices though.

diag = Diagonal(aa)
eigen(diag) # This is fine.
herm = Hermitian(aa)
eigen(herm) # This runs forever

@dkarrasch dkarrasch added the linear algebra Linear algebra label Nov 10, 2020
dkarrasch pushed a commit that referenced this issue Dec 9, 2020
KristofferC pushed a commit that referenced this issue Dec 14, 2020
… now throws exception (#38408)

(cherry picked from commit a813a6e)
staticfloat pushed a commit that referenced this issue Jan 15, 2021
… now throws exception (#38408)

(cherry picked from commit a813a6e)
@andreasnoack
Copy link
Member

The LAPACK world is free from Infs and NaNs. It is assumed that the inputs don't include these values and LAPACK promises not to produce them. Instead, LAPACK returns non-zero info values.

ElOceanografo pushed a commit to ElOceanografo/julia that referenced this issue May 4, 2021
staticfloat pushed a commit that referenced this issue Dec 23, 2022
… now throws exception (#38408)

(cherry picked from commit a813a6e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants