Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Fortran 95 Interface Conventions for LAPACK Routines

Intel® oneAPI Math Kernel Library (oneMKL) implements the Fortran 95 interface to LAPACK through wrappers that call respective FORTRAN 77 routines. This interface uses such Fortran 95 features as assumed-shape arrays and optional arguments to provide simplified calls to LAPACK routines with fewer arguments.

NOTE:

For LAPACK, Intel® oneAPI Math Kernel Library (oneMKL) offers two types of the Fortran 95 interfaces:

  • using mkl_lapack.fi only through the include 'mkl_lapack.fi' statement. Such interfaces allow you to make use of the original LAPACK routines with all their arguments
  • using lapack.f90 that includes improved interfaces. This file is used to generate the module files lapack95.mod and f95_precision.mod. See also the section "Fortran 95 interfaces and wrappers to LAPACK and BLAS" of the Intel® oneAPI Math Kernel Library (oneMKL) Developer Guide for details. The module files are used to process the FORTRAN use clauses referencing the LAPACK interface: use lapack95 and use f95_precision.

The main conventions for the 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. In rare cases, formal argument names may be different. For instance, select instead of selctg.

  • 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 the 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.

    NOTE:

    Internally, workspace arrays are allocated by the Fortran 95 interface wrapper, and are of optimal size for the best performance of the routine.

    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 the Fortran 95 interface and may or may not be present in the calling sequence. An argument can be declared optional if it meets one of the following conditions:

    • If an argument value is completely defined by the presence or absence of another argument in the calling sequence, it can be declared 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 the 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 the 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.

    • If this value is equal to -i, the ith parameter (counting parameters in the FORTRAN 77 interface, not the Fortran 95 interface) had an illegal value.

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

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