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. #780

Closed
s-baumann opened this issue Nov 8, 2020 · 5 comments · Fixed by JuliaLang/julia#38408

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
Collaborator

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

@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.

staticfloat referenced this issue in JuliaLang/julia Dec 23, 2022
@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

Successfully merging a pull request may close this issue.

4 participants