Without seeing the actual eigenvectors you receive, my first reaction is to suggest that your eigenvectors differ by a sign.
The definition of an eigenvector doesn't specify the sign of the elements (i.e. the handedness of the space). Therefore, different programs (different algorithms) might emit eigenvectors which differ only by a sign. For example, the following vectors are all valid eigenvectors spanning a 2D space: v1, v2 = [1 1]', [1 -1]' v1, v2 = [1 1]', [-1 1]' v1, v2 = [-1 -1]', [1 -1]' v1, v2 = [-1 -1]', [-1 1]' Since the definition is ambiguous, different programs may emit one or another of these eigenvector pairs. Best regards, Stuart Brorson Northeastern University Boston, Mass. ________________________________ From: help-gsl-bounces+s.brorson=northeastern....@gnu.org <help-gsl-bounces+s.brorson=northeastern....@gnu.org> on behalf of help-gsl-requ...@gnu.org <help-gsl-requ...@gnu.org> Sent: Thursday, January 4, 2024 12:00 PM To: help-gsl@gnu.org <help-gsl@gnu.org> Subject: Help-gsl Digest, Vol 229, Issue 1 Send Help-gsl mailing list submissions to help-gsl@gnu.org To subscribe or unsubscribe via the World Wide Web, visit https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.gnu.org%2Fmailman%2Flistinfo%2Fhelp-gsl&data=05%7C02%7Cs.brorson%40northeastern.edu%7C2d3f98b335804a9eb43e08dc0d46ca9c%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C638399844927330730%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=z1OO4VU282tn5LiGXrYJUfx%2F7AcLaLFVDWW3YPYR6DI%3D&reserved=0<https://lists.gnu.org/mailman/listinfo/help-gsl> or, via email, send a message with subject or body 'help' to help-gsl-requ...@gnu.org You can reach the person managing the list at help-gsl-ow...@gnu.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Help-gsl digest..." Today's Topics: 1. Different eigenvectors obtained from gsl_eigen_hermv compared with scipy.linalg.eigh (Jiasen Guo) ---------------------------------------------------------------------- Message: 1 Date: Wed, 3 Jan 2024 23:39:34 -0500 From: Jiasen Guo <jiasenguo1...@gmail.com> To: help-gsl@gnu.org Subject: Different eigenvectors obtained from gsl_eigen_hermv compared with scipy.linalg.eigh Message-ID: <CAL+Ws-BSKOMZNh=m92u-twj_tntwaajbvm13ovt8ax5tf0u...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: test.zip Type: application/x-zip-compressed Size: 2376 bytes Desc: not available URL: <https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.gnu.org%2Farchive%2Fhtml%2Fhelp-gsl%2Fattachments%2F20240103%2F7dafe09b%2Fattachment.bin&data=05%7C02%7Cs.brorson%40northeastern.edu%7C2d3f98b335804a9eb43e08dc0d46ca9c%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C638399844927330730%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GWsPeV4c6qlerT2BJH5VfD2AuSQxQCStnkf4GZY2cyA%3D&reserved=0<https://lists.gnu.org/archive/html/help-gsl/attachments/20240103/7dafe09b/attachment.bin>> ------------------------------ Subject: Digest Footer _______________________________________________ Help-gsl mailing list Help-gsl@gnu.org https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.gnu.org%2Fmailman%2Flistinfo%2Fhelp-gsl&data=05%7C02%7Cs.brorson%40northeastern.edu%7C2d3f98b335804a9eb43e08dc0d46ca9c%7Ca8eec281aaa34daeac9b9a398b9215e7%7C0%7C0%7C638399844927330730%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=z1OO4VU282tn5LiGXrYJUfx%2F7AcLaLFVDWW3YPYR6DI%3D&reserved=0<https://lists.gnu.org/mailman/listinfo/help-gsl> ------------------------------ End of Help-gsl Digest, Vol 229, Issue 1 **************************************** Without