Error Handling
KML_LAPACK checks the input parameters. If an error such as a null pointer or invalid value occurs, the LAPACK error handling function xerbla_ is invoked. By default, the xerbla_ implementation in Netlib LAPACK is used.
In this implementation, the function prints the following error message and the process exits with error code 0:
** On entry to FUNC parameter number N had an illegal value
In the preceding message, FUNC indicates the name of the LAPACK function where the error occurs, and N indicates the parameter sequence number.
You can customize the xerbla_() function to avoid exiting the entire program when the error occurs. The following is an example:
void xerbla_(const char *func, const int *param, int funcLen)
{
printf("XERBLA: function %.*s, info %i.\n", funcLen, func, *param);
}
When the preceding example function is used, a line of error message is printed when the parameter is incorrect, but the process does not exit. In this case, the result is returned to the function caller and the info parameter is set to the corresponding error parameter value.
Please note that:
- When multiple parameter errors exist, info may be set to the sequence number of any of the problematic parameters (negation).
- When the input matrix dimension is too large to be calculated properly, info is set to the sequence number (negation) of the related dimension parameter.
- A user program must link the file that contains the customized xerbla_ implementation before linking the liblapack_adapt.a file. Otherwise, repeated symbol definition errors may occur or the xerbla_ implementation of Netlib LAPACK is still used.
- If a customized xerbla_ is provided for the implementation, the handling of all errors (including those related functions not optimized by KML_LAPACK) uses this implementation.