F07AJF (DGETRI) (PDF version)
F07 Chapter Contents
F07 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

F07AJF (DGETRI)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

F07AJF (DGETRI) computes the inverse of a real matrix A, where A has been factorized by F07ADF (DGETRF).

2  Specification

SUBROUTINE F07AJF ( N, A, LDA, IPIV, WORK, LWORK, INFO)
INTEGER  N, LDA, IPIV(*), LWORK, INFO
REAL (KIND=nag_wp)  A(LDA,*), WORK(max(1,LWORK))
The routine may be called by its LAPACK name dgetri.

3  Description

F07AJF (DGETRI) is used to compute the inverse of a real matrix A, the routine must be preceded by a call to F07ADF (DGETRF), which computes the LU factorization of A as A=PLU. The inverse of A is computed by forming U-1 and then solving the equation XPL=U-1 for X.

4  References

Du Croz J J and Higham N J (1992) Stability of methods for matrix inversion IMA J. Numer. Anal. 12 1–19

5  Parameters

1:     N – INTEGERInput
On entry: n, the order of the matrix A.
Constraint: N0.
2:     A(LDA,*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array A must be at least max1,N.
On entry: the LU factorization of A, as returned by F07ADF (DGETRF).
On exit: the factorization is overwritten by the n by n matrix A-1.
3:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F07AJF (DGETRI) is called.
Constraint: LDAmax1,N.
4:     IPIV(*) – INTEGER arrayInput
Note: the dimension of the array IPIV must be at least max1,N.
On entry: the pivot indices, as returned by F07ADF (DGETRF).
5:     WORK(max1,LWORK) – REAL (KIND=nag_wp) arrayWorkspace
On exit: if INFO=0, WORK1 contains the minimum value of LWORK required for optimum performance.
6:     LWORK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which F07AJF (DGETRI) is called, unless LWORK=-1, in which case a workspace query is assumed and the routine only calculates the optimal dimension of WORK (using the formula given below).
Suggested value: for optimum performance LWORK should be at least N×nb, where nb is the block size.
Constraint: LWORKmax1,N or LWORK=-1.
7:     INFO – INTEGEROutput
On exit: INFO=0 unless the routine detects an error (see Section 6).

6  Error Indicators and Warnings

Errors or warnings detected by the routine:
INFO<0
If INFO=-i, the ith parameter had an illegal value. An explanatory message is output, and execution of the program is terminated.
INFO>0
If INFO=i, the ith diagonal element of the factor U is zero, U is singular, and the inverse of A cannot be computed.

7  Accuracy

The computed inverse X satisfies a bound of the form:
XA-IcnεXPLU ,
where cn is a modest linear function of n, and ε is the machine precision.
Note that a similar bound for AX-I cannot be guaranteed, although it is almost always satisfied. See Du Croz and Higham (1992).

8  Further Comments

The total number of floating point operations is approximately 43n3.
The complex analogue of this routine is F07AWF (ZGETRI).

9  Example

This example computes the inverse of the matrix A, where
A= 1.80 2.88 2.05 -0.89 5.25 -2.95 -0.95 -3.80 1.58 -2.69 -2.90 -1.04 -1.11 -0.66 -0.59 0.80 .
Here A is nonsymmetric and must first be factorized by F07ADF (DGETRF).

9.1  Program Text

Program Text (f07ajfe.f90)

9.2  Program Data

Program Data (f07ajfe.d)

9.3  Program Results

Program Results (f07ajfe.r)


F07AJF (DGETRI) (PDF version)
F07 Chapter Contents
F07 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012