# Fortran 95 Interface Conventions

Fortran 95 interface to LAPACK is implemented through wrappers that call respective Fortran 77 routines. This interface uses such features of Fortran 95 as assumed-shape arrays and optional arguments to provide simplified calls to LAPACK routines with fewer arguments.

### Note

For LAPACK, Intel MKL offers two types of Fortran 95 interfaces:

- using mkl_lapack.fi only through `include ‘mkl_lapack.fi’` statement. Such interfaces allow you to make use of the original LAPACK routines with all their arguments
- using mkl_lapack.f90 that includes improved interfaces described below. This file is used to generate the module files mkl95_lapack.mod and mkl95_precision.mod. See also section “Fortran 95 interfaces and wrappers to LAPACK and BLAS” of Intel® MKL User's Guide for details. The module files are used to process the FORTRAN use clauses referencing the LAPACK interface: `use mkl95_lapack` and `use mkl95_precision`.

The main conventions for Fortran 95 interface are as follows:

- The names of arguments used in Fortran 95 call are typically the same as for the respective generic (Fortran 77) interface. However, to reduce the number of argument names used in the library, Fortran 95 interface uses the following identity settings of formal argument names:

  Generic Argument Name | Fortran 95 Argument Name
  --- | ---
  ap | a
  ab | a
  afb | af
  afp | af
  bp | b
  bb | b
  selctg | select

  Note that these name changes of formal arguments have no impact on program semantics and follow the unification conventions.

- Input arguments such as array dimensions are not required in Fortran 95 and are skipped from the calling sequence. Array dimensions are reconstructed from the user data that must exactly follow the required array shape.

  Another type of generic arguments that are skipped in Fortran 95 interface are arguments that represent workspace arrays (such as work, rwork, and so on). The only exception are cases when workspace arrays return significant information on output.

  An argument can also be skipped if its value is completely defined by the presence or absence of another argument in the calling sequence, and the restored value is the only meaningful value for the skipped argument.

- Some generic arguments are declared as optional in Fortran 95 interface and may or may not be present in the calling sequence. An argument can be declared optional if it satisfies one of the following conditions:

  - If the argument value is completely defined by the presence or absence of another argument in the calling sequence, it can be declared as optional. The difference from the skipped argument in this case is that the optional argument can have some meaningful values that are distinct from the value reconstructed by default. For example, if some argument (like jobz) can take only two values and one of these values directly implies the use of another argument, then the value of jobz can be uniquely reconstructed from the actual presence or absence of this second argument, and jobz can be omitted.

  - If an input argument can take only a few possible values, it can be declared as optional. The default value of such argument is typically set as the first value in the list and all exceptions to this rule are explicitly stated in the routine description.

  - If an input argument has a natural default value, it can be declared as optional. The default value of such optional argument is set to its natural default value.

- Argument info is declared as optional in Fortran 95 interface. If it is present in the calling sequence, the value assigned to info is interpreted as follows:

  - If this value is more than -1000, its meaning is the same as in Fortran 77 routine.

  - If this value is equal to -1000, it means that there is not enough work memory.

  - If this value is equal to -1001, incompatible arguments are present in the calling sequence.

- Optional arguments are given in square brackets in Fortran 95 call syntax.

“Fortran 95 Notes” subsection at the end of the topic describing each routine details concrete rules for reconstructing the values of omitted optional parameters.

- Intel® MKL Fortran 95 Interfaces for LAPACK Routines vs. Netlib Implementation

Parent topic: LAPACK Routines: Linear Equations