New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1062 - SelfAdjointEigenSolver incorrect with RowMajor matrices
Summary: SelfAdjointEigenSolver incorrect with RowMajor matrices
Alias: None
Product: Eigen
Classification: Unclassified
Component: Eigenvalues (show other bugs)
Version: 3.2
Hardware: x86 - 64-bit Linux
: Normal Wrong Result
Assignee: Nobody
Depends on:
Reported: 2015-09-03 12:55 UTC by tyldurd
Modified: 2015-09-04 16:33 UTC (History)
5 users (show)


Description tyldurd 2015-09-03 12:55:40 UTC
SelfAdjointEigenSolver gives different results if used with row major or column major matrices. 
The differences seem to increase with the dimension of the matrix. 
The type also has an influence: floats give results worse than double. 
Complex floats are even worse.
I also noted differences while using ComplexEigenSolver, but they are smaller.

Here is a code sample to illustrate the problem:

#include "Eigen/Dense"

using namespace Eigen;
using namespace std;

int main() {

  typedef float mytype ;
  typedef Matrix<complex<mytype>, Dynamic, Dynamic> EigMatCM;
  typedef Matrix<complex<mytype>, Dynamic, Dynamic, RowMajor> EigMatRM;

  int d = 20;

  EigMatCM X = EigMatCM::Random(d,d);
  EigMatCM A = X + X.transpose().conjugate();
  SelfAdjointEigenSolver<EigMatCM> es(A);
  EigMatRM Xr = X;
  EigMatRM Ar = Xr + Xr.transpose().conjugate();
  SelfAdjointEigenSolver<EigMatRM> esr(Ar);

I compared the output to the one given by numpy.linalg.eig function, and only the row major version seems to give incorrect results.
Comment 1 Gael Guennebaud 2015-09-04 16:15:40 UTC
This issue does not apply to the default branch, only the 3.2 branch is affected.
Comment 2 Gael Guennebaud 2015-09-04 16:33:21 UTC
Branch:      3.2
Summary:     Bug 1062: backport fix of SelfAdjointEigenSolver for RowMajor matrices from default branch

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