Skip to content

eigen of complex Hermitian matrix with NaNs does not throw error #931

@mtfishman

Description

@mtfishman

As the title says, I've found that calling eigen on a complex Hermitian matrix with NaNs does not throw an error:

julia> using LinearAlgebra

julia> eigen(Hermitian(fill(complex(NaN), 2, 2)))
Eigen{ComplexF64, Float64, Matrix{ComplexF64}, Vector{Float64}}
values:
2-element Vector{Float64}:
 NaN
 NaN
vectors:
2×2 Matrix{ComplexF64}:
 NaN+0.0im  NaN+0.0im
 NaN+0.0im  NaN+0.0im

while I see:

julia> eigen(Hermitian(fill(NaN, 2, 2)))
ERROR: ArgumentError: matrix contains Infs or NaNs
[...]

julia> eigen(fill(complex(NaN), 2, 2))
ERROR: ArgumentError: matrix contains Infs or NaNs

It looks like it could be fixed by adding a call to chkuplofinite inside the complex version of syevr!.

This is with:

julia> versioninfo()
Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) E-2176M  CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = vim

but I've checked on Julia 1.7, 1.8, and 1.9 using both OpenBLAS and MKL.

Related to #406.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions