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

LAPACKE_zgeev - Eigenvalue - Eigenvector

apocalx
Beginner
508 Views

Bonjour,

J'ai quelques difficultés a bien comprendre les résultats de l'exemple "LAPACKE_zgeev".

Dans l'exemple, c'est écrit que A*v(j) = lambda(j)*v(j)

ou A est la matrice initial, v(j) le right Eigenvector et lambda(j) le Eigenvalue.

Sauf que si je prends la matrice de l'exemple:

 ( -3.84,  2.25) ( -8.94, -4.75) (  8.95, -6.53) ( -9.87,  4.82)
 ( -0.66,  0.83) ( -4.40, -3.82) ( -3.50, -4.26) ( -3.15,  7.36)
 ( -3.99, -4.73) ( -5.88, -6.60) ( -3.36, -0.40) ( -0.75,  5.23)
 (  7.74,  4.18) (  3.66, -7.53) (  2.58,  3.60) (  4.59,  5.41)

Le EigenValue de l'exemple:

( -9.43,-12.98) ( -3.44, 12.69) (  0.11, -3.40) (  5.76,  7.13)

Et le right EigenVector de l'exemple:

 (  0.43,  0.33) (  0.83,  0.00) (  0.60,  0.00) ( -0.31,  0.03)
 (  0.51, -0.03) (  0.08, -0.25) ( -0.40, -0.20) (  0.04,  0.34)
 (  0.62,  0.00) ( -0.25,  0.28) ( -0.09, -0.48) (  0.36,  0.06)
 ( -0.23,  0.11) ( -0.10, -0.32) ( -0.43,  0.13) (  0.81,  0.00)

Alors A*v(j) n'est pas égal a lambda(j)*v(j), ce qui devrait etre le cas.

De plus, le resultats (EigenValue et EigenVectors) ne correspondent pas non plus a ce que Matlab me donne avec [V,D] = eig(A) 

Est-ce que il y a une subtilité que je ne comprends pas?

merci

MarcB

0 Kudos
2 Replies
mecej4
Honored Contributor III
508 Views

You have shown only two significant digits in the results, which is barely sufficient to check them. However, they agree with the results from Matlab. Please note that MKL/Lapack and Matlab may not report the eigenvalues and matching eigenvectors in the same order. 

With Matlab 7.5, I obtained the following results, which agree with those that you reported (taking the altered order into account):

A=[complex( -3.84,  2.25) complex( -8.94, -4.75) complex(  8.95, -6.53) complex( -9.87,  4.82);
 complex( -0.66,  0.83) complex( -4.40, -3.82) complex( -3.50, -4.26) complex( -3.15,  7.36);
 complex( -3.99, -4.73) complex( -5.88, -6.60) complex( -3.36, -0.40) complex( -0.75,  5.23);
 complex(  7.74,  4.18) complex(  3.66, -7.53) complex(  2.58,  3.60) complex(  4.59,  5.41)];
[V,D]=eigs(A)
V =
  Columns 1 through 2
  4.3086e-001 +3.2681e-001i  8.2568e-001              
  5.0874e-001 -2.8833e-002i  7.5029e-002 -2.4873e-001i
  6.1985e-001               -2.4576e-001 +2.7887e-001i
 -2.2693e-001 +1.1044e-001i -1.0343e-001 -3.1920e-001i
  Columns 3 through 4
 -3.0543e-001 +3.3332e-002i  5.9840e-001              
  3.9783e-002 +3.4451e-001i -4.0048e-001 -2.0145e-001i
  3.5833e-001 +6.0645e-002i -9.0080e-002 -4.7526e-001i
  8.0824e-001               -4.3484e-001 +1.3372e-001i
D =
  Columns 1 through 2
 -9.4299e+000 -1.2983e+001i            0              
            0               -3.4418e+000 +1.2690e+001i
            0                          0              
            0                          0              
  Columns 3 through 4
            0                          0              
            0                          0              
  5.7562e+000 +7.1286e+000i            0              
            0                1.0555e-001 -3.3950e+000i

 

0 Kudos
mecej4
Honored Contributor III
508 Views

Please show the source code/Matlab scripts that you used. Neither the Matlab results nor the Lapack results in #3  are correct. Here is what I see in Matlab:

A =
  -2.0336e-03 + 3.9531e-03i  -1.8461e-04 - 1.3929e-05i  -1.8461e-04 - 1.3929e-05i
  -1.8461e-04 - 1.3929e-05i  -2.0336e-03 + 3.9531e-03i  -1.8461e-04 - 1.3929e-05i
  -1.8461e-04 - 1.3929e-05i  -1.8461e-04 - 1.3929e-05i  -2.0336e-03 + 3.9531e-03i
>> [V,D]=eigs(A)
V =
   5.7735e-01 + 2.0269e-08i  -1.3900e-02 + 1.0195e-01i   8.0542e-01              
   5.7735e-01 + 3.8170e-10i  -6.9267e-01 - 1.0195e-01i  -4.0995e-01 + 1.1584e-01i
   5.7735e-01                 7.0657e-01                -3.9547e-01 - 1.1584e-01i
D =
  -2.4028e-03 + 3.9252e-03i            0                          0              
            0                -1.8490e-03 + 3.9670e-03i            0              
            0                          0                -1.8490e-03 + 3.9670e-03i

Similarly, from Lapack using code adapted from geev.f90 in the MKL examples directory:

  VR on exit :
( 0.5773503E+00 ,  0.2026919E-07) ( 0.8054216E+00 ,  0.0000000E+00) (-0.1390000E-01 ,  0.1019502E+00)
( 0.5773503E+00 ,  0.3817009E-09) (-0.4099496E+00 ,  0.1158433E+00) (-0.6926651E+00 , -0.1019502E+00)
( 0.5773503E+00 ,  0.0000000E+00) (-0.3954719E+00 , -0.1158434E+00) ( 0.7065651E+00 ,  0.0000000E+00)

which agrees with the Matlab results after you interchange the second and third right eigenvectors.

0 Kudos
Reply