{"action":"created","issue":{"url":"https://api.github.com/repos/TRIQS/triqs/issues/219","labels_url":"https://api.github.com/repos/TRIQS/triqs/issues/219/labels{/name}","comments_url":"https://api.github.com/repos/TRIQS/triqs/issues/219/comments","events_url":"https://api.github.com/repos/TRIQS/triqs/issues/219/events","html_url":"https://github.com/TRIQS/triqs/issues/219","id":73276090,"number":219,"title":"Problem with matrix<complex<double>> eigenvalues","user":{"login":"sophiechauvin","id":9214902,"avatar_url":"https://avatars.githubusercontent.com/u/9214902?v=3","gravatar_id":"","url":"https://api.github.com/users/sophiechauvin","html_url":"https://github.com/sophiechauvin","followers_url":"https://api.github.com/users/sophiechauvin/followers","following_url":"https://api.github.com/users/sophiechauvin/following{/other_user}","gists_url":"https://api.github.com/users/sophiechauvin/gists{/gist_id}","starred_url":"https://api.github.com/users/sophiechauvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sophiechauvin/subscriptions","organizations_url":"https://api.github.com/users/sophiechauvin/orgs","repos_url":"https://api.github.com/users/sophiechauvin/repos","events_url":"https://api.github.com/users/sophiechauvin/events{/privacy}","received_events_url":"https://api.github.com/users/sophiechauvin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-05T10:33:36Z","updated_at":"2015-07-22T11:29:04Z","closed_at":null,"body":"Dear all,\r\n\r\nI tried to write the following two tests in test/triqs/arrays, which give different answers:\r\nTest n°1:\r\n#include <triqs/arrays.hpp>\r\n#include <iostream>\r\n#include <triqs/arrays/linalg/eigenelements.hpp>\r\n#include <triqs/arrays/matrix.hpp>\r\n\r\nusing triqs::arrays::array;\r\nusing triqs::arrays::matrix;\r\nusing triqs::arrays::linalg::eigenvalues;\r\nusing triqs::clef::placeholder;\r\nusing triqs::arrays::matrix_view;\r\n\r\nint main(int argc,char ** argv){\r\n\r\n //placeholder<0> i_;\r\n //placeholder<1> j_;\r\n matrix<std::complex<double>> A(2, 2);\r\n //A(i_, j_) << i_ + j_;\r\n A(0, 0) = 1.;\r\n A(0, 1) = std::complex<double>(0., 0.1);\r\n A(1, 0) = std::complex<double>(0., -0.1);\r\n A(1, 1) = 1.;\r\n std::cout << \" A = \" << A <<std::endl;\r\n\r\n auto v = eigenvalues(matrix_view<std::complex<double>>(A));\r\n std::cout << \"v = \" << v << std::endl;\r\n\r\n return 0;\r\n}\r\n\r\n\r\nfor which the output is ok:\r\n A = \r\n[[(1,0),(0,0.1)]\r\n [(0,-0.1),(1,0)]]\r\nv = [0.9,1.1]\r\n(however I'm surprised that v does not contain complex values. I know the matrix A is hermitian, but the machine doesn't).\r\n\r\n\r\nTest n°2:\r\n#include <triqs/arrays.hpp>\r\n#include <iostream>\r\n#include <triqs/arrays/linalg/eigenelements.hpp>\r\n#include <triqs/arrays/matrix.hpp>\r\n\r\nusing triqs::arrays::array;\r\nusing triqs::arrays::matrix;\r\nusing triqs::arrays::linalg::eigenvalues;\r\nusing triqs::clef::placeholder;\r\nusing triqs::arrays::matrix_view;\r\n\r\nint main(int argc,char ** argv){\r\n\r\n //placeholder<0> i_;\r\n //placeholder<1> j_;\r\n matrix<std::complex<double>> A(2, 2);\r\n //A(i_, j_) << i_ + j_;\r\n A(0, 0) = 1.;\r\n A(0, 1) = std::complex<double>(0., 0.1);\r\n A(1, 0) = std::complex<double>(0., -0.1);\r\n A(1, 1) = 1.;\r\n //std::cout << \" A = \" << A <<std::endl;\r\n\r\n auto v = eigenvalues(matrix_view<std::complex<double>>(A));\r\n std::cout << \" A = \" << A <<std::endl;\r\n std::cout << \"v = \" << v << std::endl;\r\n\r\n return 0;\r\n}\r\n\r\n\r\nfor which the output is:\r\n A = \r\n[[(1,0),(0,0.1)]\r\n [(-0.1,0),(1,0)]]\r\nv = [0.9,1.1]\r\n\r\nNote the off-diagonal elements in the matrix A!!\r\n\r\nThanks a lot for your answer!"},"comment":{"url":"https://api.github.com/repos/TRIQS/triqs/issues/comments/123678992","html_url":"https://github.com/TRIQS/triqs/issues/219#issuecomment-123678992","issue_url":"https://api.github.com/repos/TRIQS/triqs/issues/219","id":123678992,"user":{"login":"parcollet","id":1014945,"avatar_url":"https://avatars.githubusercontent.com/u/1014945?v=3","gravatar_id":"","url":"https://api.github.com/users/parcollet","html_url":"https://github.com/parcollet","followers_url":"https://api.github.com/users/parcollet/followers","following_url":"https://api.github.com/users/parcollet/following{/other_user}","gists_url":"https://api.github.com/users/parcollet/gists{/gist_id}","starred_url":"https://api.github.com/users/parcollet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parcollet/subscriptions","organizations_url":"https://api.github.com/users/parcollet/orgs","repos_url":"https://api.github.com/users/parcollet/repos","events_url":"https://api.github.com/users/parcollet/events{/privacy}","received_events_url":"https://api.github.com/users/parcollet/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T11:29:04Z","updated_at":"2015-07-22T11:29:04Z","body":"Yes, but it is a poor API, it is surprising to the user (as shown here).\r\nI do not like functions that are not pure in general.\r\nOf course here, it is like this because it is simply a lapack call, and lapack works like this ...\r\n@krivenko @mferrero : any idea to improve it ?"}}