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();
question from:
https://stackoverflow.com/questions/66055855/eigen-returning-a-double 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…