This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Eigen values and eigen values of complex matrix.

Tags: None
(comma "," separated)
abdulgh
Registered Member
Posts
2
Karma
0
Greeting to all,, I am working on arduino and using the eigen library in it... I have to find eigen values and eigen vectors of complex matrix but don't know how to do that . I have downloaded the library of eigen from github,. There are no examples in the downloaded pack which could help me,
So any one can help me out that how can i find the eigen values of complex numbers? What is the algorithm of finding it? How can i do this in arduino?
I am using arduino due board and the eigen library that i downloaded from github is compatible with Arduino due board.
jeanpauldax
Registered Member
Posts
1
Karma
0
Hello,

my first guess was to do something like

Code: Select all
Eigen::MatrixXcd B(6,6);
B.real() = Eigen::MatrixXd::Random(6,6);
B.imag() = Eigen::MatrixXd::Random(6,6);
Eigen::EigenSolver<Eigen::MatrixXcd> es(B);


Unfortunately this got me a compilation error (I only replaced the MatrixXd by MatrixXcd in the example there http://eigen.tuxfamily.org/dox/classEigen_1_1EigenSolver.html).

Then looking a bit further in the documentation I found this: http://eigen.tuxfamily.org/dox/classEigen_1_1ComplexEigenSolver.html

The code must be transformed into

Code: Select all
Eigen::MatrixXcd B(6,6);
B.real() = Eigen::MatrixXd::Random(6,6);
B.imag() = Eigen::MatrixXd::Random(6,6);
Eigen::ComplexEigenSolver<Eigen::MatrixXcd> es(B);


Then it works like charm.

Best regards and thank you for the very good work.
abdulgh
Registered Member
Posts
2
Karma
0
thanks @jeanpauldax .. as in you examples you have made a random number matrix and then u find the eigen values ... In my case I have a matrix of complex number or more specificly i have to create a matirx of complex number on the basis of some calculation ,,, so when i try to create matrix of complex number the compiler show an error that" operater = is not supoorted in this case " . so if i am using this eigen library than how could i assign a value to complex matrix ??
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
There should not be any difficulty, so please be more specific about what you tried. Moreover, if your matrix is selfadjoint (aka hermitian), then better use the SelfAdjointEigenSolver<> class which is faster and simpler to use because in this case we know that the eigenvalues are real.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]