# EVD - EigenValues ascending, EigenVectors descending?

#1

Hi,

It looks like EigenValues are sorted in ascending, EigenVectors are sorted in descending order of eigenvalues.
Is this behavior correct?

For example:

``````var m = MathNet.Numerics.LinearAlgebra.Matrix<double>.Build.Dense(2, 2);
m[0, 0] = 6.8;
m[0, 1] = 3.2;
m[1, 0] = 3.2;
m[1, 1] = 6.8;

var evd = m.Evd(MathNet.Numerics.LinearAlgebra.Symmetricity.Symmetric);
Debug.WriteLine(evd.EigenValues);
Debug.WriteLine(evd.EigenVectors);
``````

Output:
DenseVector 2-Complex
(3,6, 0)
(10, 0)

DenseMatrix 2x2-Double
0,707107 0,707107
-0,707107 0,707107

wolframalpha calculation:

http://www.wolframalpha.com/input/?i=eigenvectors{{6.8+%2C+3.2}+%2C+{3.2+%2C+6.8}}

``````10  -> (0.707107, 0.707107)
3.6 -> (-0.707107, 0.707107)
``````

Thanks

(Aristotelis Charalampakis) #2

I believe mathnet returns a matrix where each column is an eigenvector, but mathematica (which powers wolframalpha) returns a list of vectors (each row is an eigenvector).

For example, for the matrix m
(1 2 3
4 5 6
7 8 9)

mathematica returns :

(0.283349 0.641675 1.
-1.28335 -0.141675 1.

1. -2. 1.)

and mathnet returns:

(0.231971 0.816964 0.408248
0.525322 0.0901884 -0.816497
0.818673 -0.636587 0.408248)

Compare e.g. the third row of mathematica output with the third column of mathnet output to understand what I mean.

HTH