Note that eigenvectors are unique only up to a constant factor. Since the output of hermv scales the eigenvectors to unit magnitude, they can be scaled by any complex number of unit magnitude and still be a valid eigenvector. It is likely that the GSL and scipy eigenvectors differ by a constant of unit magnitude.

On 1/3/24 23:39, Jiasen Guo wrote:
Dear all,
I am having an issue using gsl_eigen_hermv to reproduce a complex hermitian
eigenvalue problem previously solved with scipy.linalg.eigh. I have
included the cpp and python code in the attached zip file. Basically, the
matrix is created in cpp and solved using gsl. the same matrix (*real.csv*
for the real part and *imag.csv* for the imaginary part) is dumped out and
solved in Python again. While I get the same eigenvalues from the two
approaches, the eigenvalues are, however, different. And if I calculated
the module of the complex numbers in the eigenvector, then they are
identical from both methods.

I use g++ --std=c++11 test.cpp -o test.o -lgsl -lgslcblas for compilation.
Please help me understand what is the problem here. Thanks for your kind
help.

Best,
Jiasen

Reply via email to