Managing Invalid Input Checking in LAPACKE Functions
The high-level interface includes an optional, on by default, NaN check on all matrix inputs before calling any LAPACK routine. This option affects all routines. If an input matrix contains any NaNs, the input parameter corresponding to this matrix is flagged with a return value error. For example, if the fifth parameter is found to contain a NaN, the routine returns the value, -5. The middle-level interface does not contain the NaN check.
NaN checking on matrix input can be expensive. By default, NaN checking is turned on. LAPACKE provides a way to set it through the environment variable:
- Setting environment variable LAPACKE_NANCHECK to 0 turns OFF NaN-checking
- Setting environment variable LAPACKE_NANCHECK to 1 turns ON NaN-checking
The other way is the call the LAPACKE_set_nancheck function; see the Developer Reference for C's LAPACK Auxiliary Routines section for more information.
Note that the NaN-checking flag value set by the call to LAPACKE_set_nancheck always has higher priority than the environment variable, LAPACKE_NANCHECK.