![]() Registered Member ![]()
|
Hi All,
I'm experiencing a very interesting issue I try to solve the teh generalized eigenvalue problem where all inner products of matrices are positive and matrices are symmetrical. Compared with the other libraries the results are drastically different. Having such a different results made me think that I have to apply additional multiplication, division or any another operation to get the correct results. I use the following code to get the eigenvalues.
|
![]() Moderator ![]()
|
What's the output of (A*es.eigenvectors() - B*es.eigenvectors()*es.eigenvalues().asDiagonal()).norm() / (A*es.eigenvectors()).norm() ??
If that's close to zero, then there is an issue and we would need the values of A and B to debug it. Also, note that the matrix B must be positive definite, not only symmetric. |
![]() Registered Member ![]()
|
Hi ggael,
Is it possible that there is mis-typing in your expression, I'm not very much familiar with Eigen syntax for the time being, but I already tried every possible combinaation of placing the paranthesis but never worked. AS far as I can deduct from the expression it is kind of back-substitution in the original eigen equation, to testify that the righ hand and left hand side are equal to each other ? Regards, |
![]() Moderator ![]()
|
works for me with Eigen 3.2:
btw, most numerical tools work on double by default, so it might be fair to compare using double as well. |
![]() Registered Member ![]()
|
Sorry my bad, As a result yes it produces a value close to zero 5.25705e-6.
Below is the main appilcation body : The matrix notation given in IN.txt file is actually stiffness matrix which is widely used in engineering problems, I only store the upper triangle of matrices and populate the rest in code manually. The other file mass.txt is mass matrix of simplified form where there is only products on the diagonal of it. Files needed during the execution are https://www.dropbox.com/s/uv0xodjo0zopqzx/IN.txt https://www.dropbox.com/s/d4d99akbehbv98d/mass.txt
|
![]() Moderator ![]()
|
I don't see anything wrong.
|
![]() Moderator ![]()
|
Moreover, I get the same result than with MatLab. However, in the case that not all entries are stored in the files, then make sure that you call A.setZero(); and B.setZero(); after resizing them. By default, Eigen's matrices are not initialized to zero.
|
![]() Registered Member ![]()
|
If you used the main code, can you share your "result.txt" file output produced from application. I used another independent library Slepc and another source code both are using subspace algorithm to find the lowest eigenvalues and they converged nicely #2) . Although the Eigen and forementioned libraries use different algorithms aren't they supposed to produce the same converging results?
I provide the outputs from both libraries. #1) Eigen library produced results which start with following values : 2.38269 4.8292 6.82543 8.96906 14.5238 16.0879 16.2533 20.5156 20.5895 27.6132 71.2584 157.663 157.777 164.934 297.029 586.402 586.969 870.542 991.488 1462.9 1463.6 2456.81 2613.91 2614.97 2932.81 3217.96 3238.51 3436.77 3795.85 3814.18 3816.28 3948.37 3974.94 5628.21 6787.2 7017.32 7090.46 7210.12 7267.28 10928.5 16859.8 19314.4 30256.4 32426 44611.2 46697 #2) Slepc 0.168948 1.714001 2.605187 2.688302 3.523136 4.037952 6.982649 7.802687 9.924228 |
![]() Moderator ![]()
|
I got:
but do not forget to add the setZero()! |
![]() Registered Member ![]()
|
OK thanks after your guidance I found also the same result with slight difference. What could be the reason behind of those slight deviations in eigenvalues ? Do you think that this is due to the floating precision ?
Regards, |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]