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

EigenSolver hangs

Tags: None
(comma "," separated)
JaimeF
Registered Member
Posts
3
Karma
0
OS

EigenSolver hangs

Thu Oct 21, 2010 7:44 am
Hi,

I searched the forum but couldn't find anything about what can make eigenSolver stop working.

In other words, i have a big/medium/small matrix, tried various kinds of sizes (16 cols by 30/380/15400/308000 rows) and none of those sizes did any diference (all the same matrix, only cut the row size).

The problem is, when I call the eigenSolver constructor, it stops there, 100% cpu but nothing more, already left it 24h working, and still had not finished the constructor.

This is how i call the constructor, although I already tried calling it with "new Eigen::EigenSolver<Eigen::MatrixXd>(aMatrix)".

>> Eigen::EigenSolver<Eigen::MatrixXd> solver(aMatrix);


So my question is:
What can cause this?


Thank you
-Jaime
jitseniesen
Registered Member
Posts
204
Karma
2

Re: EigenSolver hangs

Thu Oct 21, 2010 9:26 am
Jaime, I don't quite understand what you're doing. EigenSolver computes the eigenvalues and eigenvectors of a matrix, and this makes only sense for a square matrix (same number of rows and columns). The Eigen library should check this and abort immediately.

What version are you using? There was one problem with Eigen2 (the current stable version) that EigenSolver hung when the matrix you give to it has NaN in it - it may even be possible that the computation introduces NaN in the matrix, though we've never seen that.

If you want us to look further into it, please tell us which version you are using and give us some self-contained example code or at the least the matrix.
JaimeF
Registered Member
Posts
3
Karma
0
OS

Re: EigenSolver hangs

Thu Oct 21, 2010 11:51 am
I'm using eigen2.

And the matrix has -nan's but i dont understand why..

example (a row):
"-nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: EigenSolver hangs

Thu Oct 21, 2010 11:59 am
What would help is if you could make a short program reproducing the problem, and attach it to a bug report.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
severine
Registered Member
Posts
1
Karma
0
OS

Re: EigenSolver hangs

Fri Oct 29, 2010 3:17 pm
Hello,

It seems that I have a similar problem of EigenSolver hanging. I'm sorry if I was supposed to open a new discussion, let me know if I should.

I have 2 meshes with a different number of cells and a matrix defined at each cell. I loop on all cells and compute the eigenvalues and eigenvectors of the matrix.
My first mesh has 6 millions cells and the loop goes to its end with no problem. My second mesh has 15 millions cells and the computation gets stuck.
CPU is 100%, but nothing ever happens, even after a very long time.

Here is the code I implemented:

for (int c = 0; c < cellsNumber; c++)
{
Matrix3d m;
for (int i=0; i<3; i++)
for (int j=0; j<3; j++)
m(i,j) = myMatrix[c][i][j];
Eigen::EigenSolver<Matrix3d> *eigensolver = new Eigen::EigenSolver<Matrix3d>(m);
Eigen::EigenSolver<Matrix3d>::EigenvalueType *val = new Eigen::EigenSolver<Matrix3d>::EigenvalueType(eigensolver->eigenvalues());
Vector3d reVal = val->real().cast<double>();
Vector3d imVal = val->imag().cast<double>();
Eigen::EigenSolver<Matrix3d>::EigenvectorType *vec = new Eigen::EigenSolver<Matrix3d>::EigenvectorType(eigensolver->eigenvectors());
Matrix3d reVec = vec->real().cast<double>();
Matrix3d imVec = vec->imag().cast<double>();

/* ... result storage ... */
for (int i=0; i<3; i++)
{
myReEigenValues[c][i] = reVal(i);
myImEigenValues[c][i] = imVal(i);
for (int j=0; j<3; j++)
{
myReEigenVectors[c][i][j] = reVec(j,i);
myImEigenVectors[c][i][j] = imVec(j,i);
}
}
delete eigensolver;
delete val;
delete vec;
}

I am using Eigen2.0.15.
I'm sorry I can't say exactly where I get stuck because I have to run the code remotely on another computer because mine can't handle so big meshes. Therefore I could not debug. (But if I remove just the Eigen2 code from my code, I can go to the end of the loop, which makes me think the problem might come from my implementation of the call to Eigen2).

Any advice?
Thanks a lot in advance.
Séverine
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: EigenSolver hangs

Fri Oct 29, 2010 3:21 pm
Can you please turn this example code into a full self-contained compilable example? So I can try to reproduce.

Can you please then attach that to a bug report?

The first thing to do is to enable raising-signals-on-floating-point-exceptions. Thus we'll get a stack trace pointing to where nan's are first created.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
JaimeF
Registered Member
Posts
3
Karma
0
OS

Re: EigenSolver hangs

Sun Oct 31, 2010 11:04 am
Well in my case the eigensolver was giving problems due to the matrix itself, there were some transformations I was making to the data that were not suposed.

I haven't said anything earlier because I'm still trying to get this to work and i'm not complely sure that eigensolver will behave properly, but since I'm unable to work full time on this it's taking a but longer to rewrite some code.

The main thing if i recall correctly was that i was subtracting the mean to each member of the matrix. that is: for element X1j i subtract the mean of row 1.

When I noticed this is wrong (for my algorithm) and that the correct would be to subtract the mean of column1 to elements Xi1, the eigensolver worked fine.

I did some other modifications, but i think this was the one that made eigensolver work.

However i dont want to call this as solved, since eigensolver does hang in another similar (and working) implementation, but in this case, for the same matrix, sometimes hangs, sometimes not.

As for my specific problem, i only need more time to make sure eigensolver will work fine with the final version.


Bookmarks



Who is online

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