2021年2月4日星期四

Eigen returning a double

I want to return an eigenvalue to a double (E). All the code examples use cout<<. There is some casting issue that I cannot see or understand. Much appreciated to those who have commented. This is the working code now.

float E=0;    Eigen::Matrix< double,2,2> A;  A(0,0)=1.0;  A(0,1)=2.0;  A(1,0)=1.0;  A(1,1)=4.0;    Eigen::EigenSolver<Eigen::Matrix< double,2,2>> s(A);  s.compute(A,false);  //Eigen::VectorXd eigen_values = s.eigenvalues().transpose();  complex<float> lambda = s.eigenvalues()[0];  E=lambda.real();  
https://stackoverflow.com/questions/66055855/eigen-returning-a-double February 05, 2021 at 08:23AM

没有评论:

发表评论