Design of the LAPACK95 Driver Interface

The design of LAPACK95 [12,6,14] exploits the following features of the Fortran 95 language:

**Assumed-shape arrays:**All array arguments to LAPACK95 routines are assumed-shape arrays. Arguments to specify problem dimensions or array dimensions are not used.

This implies that the actual arguments supplied to LAPACK95 routines*must*have the*exact*shape required by the problem. The most convenient ways to achieve this are:

- using allocatable arrays. For example,

- passing array sections. For example,
- REAL :: A(NMAX,NMAX), B(NMAX)

. . . - CALL LA_GESV( A(:N,:N), B(:N) )

- REAL :: A(NMAX,NMAX), B(NMAX)

Zero dimensional (empty) arrays are allowed.

There are some grounds for concern about the effect of Fortran 95 assumed-shape arrays on performance because compilers cannot assume that their storage is contiguous. The effect on performance depends on the compiler and may diminish as compilers become more effective in optimizing compiled code.

- using allocatable arrays. For example,
**Automatic allocation of work arrays:**Workspace arguments and arguments to specify their dimensions are not used.

**OPTIONAL arguments:**In LAPACK, character arguments are frequently used to specify some choice of options. In Fortran 95, a choice of options can sometimes be specified naturally by the presence or absence of optional arguments. For example, options to compute the left or right eigenvectors in LA_GEEV can be specified by the presence of the numerical arguments`VL`or`VR`, and the character arguments`JOBVL`and`JOBVR`which are required in the LAPACK routine`SGEEV`are not needed. In other routines, a character argument to specify options may still be required, but it is OPTIONAL in the sense that if it is not specified, then a default value is given. For example, in`LA_GESVX`the argument`TRANS`is OPTIONAL, with default value`'N'`.

**Generic interfaces:**The systematic occurrence in LAPACK of analogous routines for real or complex data, and for single or double precision, lends itself well to the definition of generic interfaces, allowing four different LAPACK routines to be accessed through the same LAPACK95 routine name.

Generic interfaces can also be used to cover routines whose arguments differ in rank and thus provide an increase in flexibility over LAPACK. For example, in LAPACK, routines for solving a system of linear equations (such as SGESV) allow for multiple right hand sides, and so the arrays which hold the right hand sides and solutions are always of rank 2. In LAPACK95, on the other hand, the arrays holding the right hand sides and solutions may be*either*of rank 1 (for a single right hand side)*or*of rank 2 (for several right hand sides).

**Naming:**For all LAPACK95 routine names:

- the initial letter (
`S`,`C`,`D`or`Z`) is omitted. - the letters
`LA_`are prefixed.

The naming scheme is described in detail in Section 2.1.3.

- the initial letter (
**Error-handling:**All LAPACK95 driver routines have an optional diagnostic output argument`INFO`. See Section 3.3 for details of its use.

*Derived types* are
not used in this Fortran 95
interface. They could be considered -- for example, to hold the details
of an factorization and equilibration factors. However, since LAPACK
routines are so frequently used as building blocks in larger algorithms or
applications, it has been decided that the first priority
is keeping the interface simple.