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

[Noob question] Storing Eigenvalues in external array.

Tags: None
(comma "," separated)
Mofoliage
Registered Member
Posts
1
Karma
0
Hi, I realise this is probably a very basic problem but being new to both Eigen and C++ I dont have m/any ideas. I have a large number of matrices which I need to find and store the eigenvalues for. I am able to compute the eigenvalues for each of these matrices I now need a way of storing the eigenvalues in an external array for each matrix.

I know how to access separate elements within the column vector storing the eigenvalues using eigensolver.eigenvalues()[0] so if I were able to determine how many eigenvalues each matrix produced then I am confident I could solve this problem, is there a method for doing this?

Alternatively is there a much better alternative method that I have overlooked.

Thanks,
Ben
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
The number of eigenvalues is equal to the size of the matrix. You can also retrieve it with eig.eigenvalues().size(). You can copy them into another Eigen object:

VectorXf tmp;
tmp = eig.eigenvalues();

or into custom buffers:

float * tmp = new float[eig.eigenvalues().size()];
VectorXf::Map(tmp,eig.eigenvalues().size()) = eig.eigenvalues();


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]