Search code examples
lapackblaserror-code

Looking for a List of LAPACK/BLAS Error code


I am using zheev of LAPACK (in Intel MKL). I got int INFO=99. I've been searching around internet what this corresponds to, but I cannot find the documentation with list of all the integer error code and their meaning.

Does anyone have links to the complete list of LAPACK/BLAS error codes? Or if you have one off line, could you copy and paste as an answer?


Solution

  • According to the documentation of LAPACK, the output INFO reports two kinds of error. On the one hand, if INFO<0, parameter -INFO has an illegal value. Parameters are numbered as 1,2,3,... : no 0 (Fortran). For instance, the size of the matrix is negative. On the other hand, INFO>0 reports a computational failure.

    The actual reason for the failure is described in the comments of the routine prompting the error. For instance, for zheev(), it is written:

    0: if INFO = i, the algorithm failed to converge; i off-diagonal elements of an intermediate tridiagonal form did not converge to zero.

    Looking at the source of zheev(), the matrix is scaled, reduced to trigonal form and then either the eigenvectors are not required and dsterf() is called, or the eigenvectors are to be computed and zungtr() is called to form a unitary matrix Q starting from the reflectors and zsteqr() is called to compute eigenvalues and eigenvectors of the tridiagonal matrix. The output INFO is therefore set by either dsterf() or zsteqr().

    Regarding zsteqr(), the value of INFO is incremented at line 536, each time an error remains non-null after the maximum number of iterations. Some cases potentially leading to failure of QR iterations are reported in section 1.3.6 Failure of Global convergence in Numerical Methods for General and Structured Eigenvalue Problems by Daniel Kressner. Nevertheless, the errors are often due to programming error listed as:

    • wrong type of array. For instance, zheev() expects arrays of double precision complex, that is DOUBLE COMPLEX or COMPLEX*16 in Fortran. If COMPLEX*8 is used, it likely leads to undefined behavior and it might result in positive INFO.

    • the arrays (matrix and vectors) could have been corrupted before running the LAPACK routine. For zheev(), it might be induced by INF or NaN in the array.

    • a programming error occurred in calling the routine. For instance, the argument LDA is the leading dimension of the array A. It is checked that LDA >= max(1,N) and it returns INFO=-5 if this condition is not enforced. Nevertheless, nothing prevents the programmer from allocating and array A or size n*n and specifying LDA=2*n, which would result in undefined behavior, as array index out of bound will be used. Again, a possible behavior is returning INFO=99.

    Finally, the LAPACKE wrapper of LAPACK for langage C/C++ automatically cares for allocation of work arrays. As a result, it also defines error codes, such as LAPACK_WORK_MEMORY_ERROR and LAPACK_TRANSPOSE_MEMORY_ERROR, returned in info, in lapacke.h:

    #define LAPACK_WORK_MEMORY_ERROR       -1010
    #define LAPACK_TRANSPOSE_MEMORY_ERROR  -1011
    

    Do not hesitate to ask a question on StackOverflow, reporting the error and a significant piece of code, along with a description of the unwanted behavior. Ideally, the piece of code is a sample code reproducing the error. But a piece of code showing allocation of arrays and values of inputs can prove sufficient.