Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

dgeev eigenvectors

phys
Beginner
638 Views

Greetings everyone!

I have a question concerning the (right) eigenvectors returned from (MKL) LAPACK's dgeev.

There is the dgeev example at

intels dgeev example

where the matrix

A = {{-1.01, 3.98, 3.30, 4.43, 7.31},

{ 0.86, 0.53, 8.26, 4.96, -6.43},

{-4.60, -7.04, -3.89, -7.66, -6.16},

{ 3.31, 5.29, 8.20, -7.33, 2.47},

{-4.81, 3.55, -1.51, 6.18, 5.58}};

is diagonalized. On my machine I can reproduce the results given in the link. Then, with more digits than provided in the example, the first eigenvalue and -vector (lambda, v) read (in Mathematica notation, "I" is the imaginary unit)

lambda = 2.858133 + 10.762750 I;

v = {0.108065 + 0.168648 I,

0.406313 - 0.259010 I,

0.102358 - 0.508802 I,

0.398631 - 0.091333 I,

0.539535 + 0.000000 I};

When I check in Mathematica if the eigenpair satisfies

A v = lambda v

(as it should, according to the documentation) it turns out that this is not the case :

in: A.v

out: { 4.441 + 11.539 I,

-5.131 + 13.895 I,

-5.630 - 19.365 I,

-3.115 + 6.718 I,

5.526 + 7.408 I };

in: lambda v

out: { -1.506 + 1.645 I,

-10.341 + 4.443 I,

-11.924 - 1.516 I,

-9.884 + 6.165 I,

1.542 + 5.806 I }

And indeed, the eigenvectors provided from Mathematica are different and they furthermore satisfy the eigenvalue equation as expected

in: {eval, evec} = Eigensystem;

in: A . evec[[1]]

out: { 3.225 - 0.344 I,

1.766 + 6.653 I,

-6.313 + 1.264 I,

0.933 + 3.021 I,

3.537 - 1.457 I}

in: eval[[1]] evec[[1]]

out: {3.225 - 0.344 I,

1.766 + 6.653 I,

-6.313 + 1.264 I,

0.933 + 3.021 I,

3.537 - 1.457 I}

Any idea where I am going wrong would be highly appreciated.

Have a nice day and thank you!

phys

0 Kudos
2 Replies
mecej4
Honored Contributor III
638 Views
Eigenvectors are scalable. In other words, if v is an eigenvector and c is a complex constant, c.v is also an eigenvector.

Different packages choose different scaling for eigenvectors. Before comparing results, you should match the scaling.

The matrix you gave Mathematica is the transpose of the one in the MKL example. As a result, Mathematica gave you the left eigenvectors, whereas MKL gave you the right eigenvectors. If the matrix is not hermitian, the right and left eigenvectors differ.
0 Kudos
phys
Beginner
638 Views
Wow, what a stupid mistake (however, not unexpected...).
Thank you so much mecej4!
0 Kudos
Reply