This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1013 - Eigenvalues 2x2 matrix
Summary: Eigenvalues 2x2 matrix
Status: RESOLVED FIXED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Eigenvalues (show other bugs)
Version: 3.2
Hardware: x86 - 64-bit Linux
: Normal Wrong Result
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-07 10:19 UTC by thomas.rueberg
Modified: 2019-12-04 14:36 UTC (History)
4 users (show)



Attachments
Test code to demonstrate the bug (732 bytes, text/x-c++src)
2015-05-07 10:19 UTC, thomas.rueberg
no flags Details
Patch (712 bytes, patch)
2015-05-07 10:25 UTC, thomas.rueberg
no flags Details | Diff

Description thomas.rueberg 2015-05-07 10:19:51 UTC
Created attachment 573 [details]
Test code to demonstrate the bug

Using the SelfadjointEigenSolver for a multiple of the 2x2 fixed-size identity matrix gives correct eigenvalues, but eigenvectors full of 'nan'. 
In the routine in 'src/Eigenvalues/SelfAdjointEigenSolver.h' there are specialised routines for 3x3 and 2x2 matrices. In the 3x3 case there is a check for equal eigenvalues

if((eivals(2)-eivals(0))<=Eigen::NumTraits<Scalar>::epsilon())
{
  eivecs.setIdentity();
}
else {
  // really compute the eigenvectors
}

, but in the routine for 2x2 this check is missing. It follows a division by zero in the normalisation of the vectors.
Comment 1 thomas.rueberg 2015-05-07 10:25:48 UTC
Created attachment 574 [details]
Patch
Comment 2 Gael Guennebaud 2015-05-07 13:41:04 UTC
thank you for the report, the fix is slightly more subtle, I'll push a fix soon.
Comment 4 Nobody 2019-12-04 14:36:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1013.

Note You need to log in before you can comment on or make changes to this bug.