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

LAPACKE_dggevx question for nonsymmetric evp

utab
Beginner
239 Views

Dear all,

I am puzzling with a problem on the setting of input parameters to

LAPACKE_dggevx

namely, ldvr, the size of the leading dimension of the right eigenvectors. It is mentioned in the manual

If jobvr='V', ldvr >= max(1,n)

On a 4 by 4 test problem, if I set ldvr to n it finds the eigenvectors correctly, whereas setting ldvr to 'n+1' does not give me the right eigenvectors. Is not ldvr for allocation purposes only? So why does setting ldvr to 'n+1' brings numerical problems?

More importantly, if I use this function in my code for a large system where an enlarging evp is solved in each iteration(A Lanczos solver btw), it sometimes converges but sometimes not, I am suspecting that this is related to the above mentioned problem.

I could not understand the reason of this strange problem. Will that make a difference if I use FORTRAN 77 interface?

Best,

Umut

0 Kudos
1 Reply
mecej4
Honored Contributor III
239 Views

There is nothing strange about what you noted, once you realize that LapackE is a C/C++ interface layer between your code and the underlying library routines, which were developed to be called from Fortran.

In Fortran, when you pass a 2-D array as an argument to a subprogram, and the declared array is larger than the size of the part of it that is being used, the column size used in the declaration has to be passed in the argument list so that the subprogram can correctly map elements of the 2-D array to memory addresses (or, equivalently, a 1-D array constructed by piling up columns of the 2-D matrix).

In older versions of Fortran, there was no provision for dynamic allocation of arrays, so arrays were usually declared to be large enough to cover all possible cases over the lifetime of the program. Often, therefore, when a matrix was passed as an argument only an upper-left submatrix was filled with meaningful values. The called subprogram needed a way of being told to use only that part of the argument array.

If you pass a value for the argument 'ldA' that is different from the leading dimension in the declaration of argument 'A', you have misinformed the library routine and your results will be wrong (or the program may abort before giving any results).

If you still have difficulties with this, post a small but specific example program and we may be able to suggest corrections to the calls.

0 Kudos
Reply