LAPACKE#
The LAPACKE API is a set of C interfaces to LAPACK. For each main standard
LAPACK routine <fname>
there are two correspondent LAPACKE functions:
LAPACKE_<fname>
(high-level) and LAPACKE_<fname>_work
(middle-level).
See table below for further description.
Interface Type |
Naming Convention |
Description |
---|---|---|
High-level |
|
Performs necessary memory allocations for LAPACK temporary work arrays and transpositions. If not disabled, NaN checking is performed for input arrays. |
Middle-level |
|
LAPACK work arrays are allocated by the user and the library manages memory for transpositions. NaN checking is not done for input arrays. |
The LAPACK routines acting on matrices will have an additional parameter on its
correspondent LAPACKE interfaces, matrix_layout
, to indicate if matrices
are in column-major (LAPACK_COL_MAJOR
) or row-major (LAPACK_ROW_MAJOR
)
layout.
The info
parameter is returned by LAPACKE functions rather than
being an argument. Besides the usual LAPACK error codes, two additional error
codes are added for error handling:
Error code ( |
Description |
---|---|
|
Not enough memory to allocate LAPACK work arrays. |
|
Not enough memory to allocate buffers necessary for transposition. |
Note
Even though LAPACKE is a C interface, the indices returned and utilized are 1-based indices rather than 0-based.
For LAPACKE function signatures and descriptions to the correspondent Fortran LAPACK routines see LAPACK. For additional details on LAPACKE check Netlib documentation.
NaN Checking#
The LAPACKE interface checks NaNs on inputs by default. If a NaN is found the
return value info
will indicate which input was the faulty one. The NaN
checking operation can be disabled at runtime by setting the environment
variable LAPACKE_NANCHECK
to 0 or using the function
LAPACKE_set_nancheck```LAPACKE_set_nancheck`.
Note
NaN checking can significantly affect the performance of LAPACKE functions. Consider disabling it if inputs are known to not having NaNs.
LAPACKE_get_nancheck()#
-
int LAPACKE_get_nancheck(void)#
Returns current NaN checking behavior.
0: NaN checking disabled.
1: NaN checking enabled.
LAPACKE_set_nancheck()#
-
void LAPACKE_set_nancheck(int flag)#
Sets the current NaN checking behavior indicated by flag
.
0: Disable NaN checking.
1: Enable NaN checking.
Alternatively, it is also possible to use the environment variable
LAPACKE_NANCHECK
to disable NaN checking.