2 THE LAPACKE C INTERFACE TO LAPACK
The naming scheme for the middle-level interface is to take the FORTRAN
LAPACK routine name, make it lower case, then add the prefix LAPACKE
and the suffix work. For example, the LAPACK subroutine DGETRF be-
comes LAPACKE dgetrf work.
1.2. Complex Types. Complex data types are defined by the macros
lapack complex float and lapack complex double, which represent single pre-
cision and double precision complex data types respectively. It is assumed
throughout that the real and imaginary components are stored contiguously
in memory, with the real component first. The lapack complex float and
lapack complex double macros can be either C99 Complex types, a C struct
defined type, C++ STL complex types, or a custom complex type. See
lapacke.h for more details.
1.3. Array Arguments. Arrays are passed as pointers, not as a pointer to
pointers. All the LAPACKE routines that take one or more 2D arrays as a
pointer receive a single extra parameter of type int. This argument must be
equal to either LAPACK ROW MAJOR or LAPACK COL MAJOR which are
defined in lapacke.h, specifying whether the arrays are stored in row-major
or column-major order. If a routine has multiple array inputs, they must all
use the same ordering.
Note that using row-major ordering may require more memory and time
than column-major ordering, because the routine must transpose the row-
major order to the column-major order required by the underlying LAPACK
routine.
Each 2D array argument in a FORTRAN LAPACK routine has an ad-
ditional argument that specifies its leading dimension. For row-major 2D
arrays, elements within a row are assumed to be contiguous and elements
from one row to the next are assumed to be a leading dimension apart.
For column-major 2D arrays, elements within a column are assumed to be
contiguous and elements from one column to the next are assumed to be a
leading dimension apart.
1.4. Aliasing of Arguments. Unless specified otherwise, only input argu-
ments (that is, scalars passed by values and arrays specified with the const
qualifier) may be legally aliased on a call to C interface to LAPACK.
1.5. INFO Parameters. The LAPACKE interface functions set their
lapack int return value to the value of the INFO parameter, which contains
information such as error and exit conditions. This differs from LAPACK
routines, which return this information as a FORTRAN integer parameter.
In LAPACKE, INFO is used exactly as it is in LAPACK. If INFO returns
the row or column number of a matrix using 1-based indexing in FORTRAN,
the value is not adjusted for zero-based indexing.