Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 11/07/2023
Public

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

Document Table of Contents

?getri

Computes the inverse of an LU-factored general matrix.

Syntax

call sgetri( n, a, lda, ipiv, work, lwork, info )

call dgetri( n, a, lda, ipiv, work, lwork, info )

call cgetri( n, a, lda, ipiv, work, lwork, info )

call zgetri( n, a, lda, ipiv, work, lwork, info )

call getri( a, ipiv [,info] )

Include Files

  • mkl.fi, lapack.f90

Description

The routine computes the inverse inv(A) of a general matrix A. Before calling this routine, call ?getrf to factorize A.

Input Parameters

n

INTEGER. The order of the matrix A; n 0.

a, work

REAL for sgetri

DOUBLE PRECISION for dgetri

COMPLEX for cgetri

DOUBLE COMPLEX for zgetri.

Arrays: a(lda,*), work(*).

a(lda,*) contains the factorization of the matrix A, as returned by ?getrf: A = P*L*U.

The second dimension of a must be at least max(1,n).

work(*) is a workspace array of dimension at least max(1,lwork).

lda

INTEGER. The leading dimension of a; lda max(1, n).

ipiv

INTEGER.

Array, size at least max(1, n).

The ipiv array, as returned by ?getrf.

lwork

INTEGER. The size of the work array; lworkn.

If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.

See Application Notes below for the suggested value of lwork.

Output Parameters

a

Overwritten by the n-by-n matrix inv(A).

work(1)

If info = 0, on exit work(1) contains the minimum value of lwork required for optimum performance. Use this lwork for subsequent runs.

info

INTEGER. If info = 0, the execution is successful.

If info = -i, the i-th parameter had an illegal value.

If info = i, the i-th diagonal element of the factor U is zero, U is singular, and the inversion could not be completed.

LAPACK 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or reconstructible arguments, see LAPACK 95 Interface Conventions.

Specific details for the routine getri interface are as follows:

a

Holds the matrix A of size (n,n).

ipiv

Holds the vector of length n.

Application Notes

For better performance, try using lwork = n*blocksize, where blocksize is a machine-dependent value (typically, 16 to 64) required for optimum performance of the blocked algorithm.

If you are in doubt how much workspace to supply, use a generous value of lwork for the first run or set lwork = -1.

If you choose the first option and set any of admissible lwork sizes, which is no less than the minimal value described, the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array work on exit. Use this value (work(1)) for subsequent runs.

If you set lwork = -1, the routine returns immediately and provides the recommended workspace in the first element of the corresponding array (work). This operation is called a workspace query.

Note that if you set lwork to less than the minimal required value and not -1, the routine returns immediately with an error exit and does not provide any information on the recommended workspace.

The computed inverse X satisfies the following error bound:

|XA - I|  c(n)ε|X|P|L||U|,

where c(n) is a modest linear function of n; ε is the machine precision; I denotes the identity matrix; P, L, and U are the factors of the matrix factorization A = P*L*U.

The total number of floating-point operations is approximately (4/3)n3 for real flavors and (16/3)n3 for complex flavors.