Boost logo

Ublas :

Subject: Re: [ublas] Eigenvalues & -vectors
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2010-07-05 17:43:03


Kraus Philipp wrote:
> I think there was a little mistake, because "lower" means, that the values must be filled into the upper triangle.

You're joking, right? The MKL example used "Upper" to compensate for the differences between C's row_major and fortran's column_major matrix storage format.

For your example, the matrix

1 0 0
2 2 0
3 3 4

will certainly give the eigenvalues (4,2,1) with Matlab. When you're calling syev with this matrix as "upper", syev will interpret it as the symmetric matrix

1 0 0
0 2 0
0 0 4

which certainly also has the eigenvalues (4,2,1), even so it is not the same matrix as you showed Matlab.

> if I set bindings::lower the return values are (-0.870495,-.143348,8.01384)

It would be quite cumbersome for me to start Matlab at the moment (I'm at home), so let's ask Octave about its opinion instead:

octave-3.0.3.exe:1> A = [1 2 3; 2 2 3; 3 3 4]
A =

   1 2 3
   2 2 3
   3 3 4

octave-3.0.3.exe:2> eig(A)
ans =

  -0.87050
  -0.14335
   8.01384

Pretty good match, no?

Regards,
Thomas