- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, of course! Thanks mecej4, that clarifies the situation!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page