Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
77 views
in Technique[技术] by (71.8m points)

c++ - 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();
question from:https://stackoverflow.com/questions/66055855/eigen-returning-a-double

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...