SGEEV giving incorrect results

SGEEV giving incorrect results

Hello,
I am using SGEEV to calculate the eigenvalues and right eigenvectors of a block diagonal matrix. For some examples SGEEV seems to be giving the wrong result. I have attached the code along with this post. It is almost exactly the same code as the mkl example for sgeev. I have just changed the matrix and the output routine (since I know that the eigenvectors and values are real). If V_r is the right eigenvector and D = diagonal matrix of eigenvalues for matrix A, it can be verified from the output that A*V_r != V_r*D.

I think I might be abusing the interface or just doing something plain wrong. Could someone please clarify whether the issue is with mkl or with my usage of the routine?

Thanks in advance,
C.S.N

AttachmentSize
Downloadtext/x-csrc eig_nw.c2.63 KB
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

You call the Fortran77 routine from C, and pass a one-dimensional array to it. Fortran-77 convention dictates that the matrix be stored in the one-dimensional array by concatenating the columns of the matrix. C, however, has the opposite convention, with rows concatenated. In effect, you computed the left eigenvectors of the matrix, which are equivalent to the right eigenvectors of the transpose matrix.

You can adjust for this mismatch in several ways:

1. Enter the matrix in the expected Fortran column-1, column-2, ... order.

2. Call SGEEV('V','N',...) and print VL(:)

3. Use the C-oriented LAPACKE_sgeev routine.

Ah, of course! Thanks mecej4, that clarifies the situation!

Leave a Comment

Please sign in to add a comment. Not a member? Join today