Registered Member
|
Dear All,
I got 2 question : 1.) I kindly would like to know which property should I set to get the eigenvalues ordered, because they are presented at the arbitrary order, but I want them to be from smallest to biggest? 2.) Probably it is not totally eigen library issue but I want to write those alpha values to be written to file, since alphas() or betas() are of ComplexVectorType I don't know how to convert them to simple float or double type in order to be able to write them with following code printf(myfile, "Eigen value is : %f.8", ges.alphas() ) . Your helps will be appreciated, Regards, |
Registered Member
|
I assume you want to solve a generalized eigenvalue problem solved using GeneralizedEigenSolver. In this case, the eigenvalues are complex numbers, even if all the inputs are real. Thus, for sorting the eigenvalues, you need to specify how you want to sort complex numbers (is 2+3i bigger or smaller than 3?). To print the eigenvalues, you need to do something like
If your matrix is actually symmetric, then the eigenvalues are always real and you can use GeneralizedSelfAdjointEigenSolver. This will avoid all issues with complex numbers. |
Registered Member
|
Thank you in advance,
Where actually do we specify the soting method for both type of solvers, of course with the same entity complex/complex or real/real? Regards, |
Moderator
|
You have to do it manually, there is no sorting facilities yet.
|
Registered Member
|
I should have added that there is no functionality provided in the Eigen library for this. The easiest is to copy the eigenvalues to a new vector and then use std::sort() for the sorting. You need to copy the eigenvalues first because you cannot change the eigenvalues in the GeneralizedEigenSolver object. Something like the following (code not tested):
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell