ComplexEigenSolver produces NaNs when original matrix has none

Summary

ComplexEigenSolver produces NaNs in the eigenvectors of a matrix with no NaN entries. Numpy does not produce NaNs for a byte-for-byte identical matrix.

Environment

  • Operating System : Windows/Linux
  • Architecture : x86
  • Eigen Version : 3.4.0
  • Compiler Version : Gcc 13
  • Compile Flags : -O3
  • Vector Extension :

Minimal Example

Godbolt: https://godbolt.org/z/6bEbhY8E5

Forgive the weird way of loading the matrix, it was done this way to allow me to compare directly to something I was using in Python.

For completeness, here's numpy's answer: https://gist.github.com/WardBrian/a6f4826ce65b55ae0b451419c4066eef

Steps to reproduce

See godbolt link above. It seems to be relevant that there are values very close to zero

What is the current bug behavior?

Eigenvectors returned contain NaNs

What is the expected correct behavior?

They should not.

Anything else that might help

This was originally reported in the Stan project: https://discourse.mc-stan.org/t/nans-in-complex-eigendecomposition/33676/4