## LA_INVERT

The LA_INVERT function uses LU decomposition to compute the inverse of a square array.

LA_INVERT is based on the following LAPACK routines:

Output Type
LAPACK Routine
Float
sgetrf, sgetri
Double
dgetrf, dgetri
Complex
cgetrf, cgetri
Double complex
zgetrf, zgetri

For more details, see Anderson et al., LAPACK Users' Guide, 3rd ed., SIAM, 1999.

### Syntax

Result = LA_INVERT( A [, /DOUBLE] [, STATUS=variable] )

### Return Value

The result is an array of the same dimensions as the input array.

### Arguments

#### A

The n-by-n array to be inverted.

### Keywords

#### DOUBLE

Set this keyword to use double-precision for computations and to return a double-precision (real or complex) result. Set DOUBLE = 0 to use single-precision for computations and to return a single-precision (real or complex) result. The default is /DOUBLE if A is double precision, otherwise the default is DOUBLE = 0.

#### STATUS

Set this keyword to a named variable that will contain the status of the computation. Possible values are:

• STATUS = 0: The computation was successful.
• STATUS > 0: The array is singular and the inverse could not be computed. The STATUS value specifies which value along the diagonal (starting at one) is zero.

 Note
If STATUS is not specified, any error messages will be output to the screen.

### Examples

The following program computes the inverse of a square array:

```PRO ExLA_INVERT
; Create a square array.
array =[[1d, 2, 1], \$
[4, 10, 15], \$
[3, 7, 1]]
; Compute the inverse and check the error.
ainv = LA_INVERT(array)
PRINT, 'LA_INVERT Identity Matrix:'
PRINT, ainv ## array
END
```

When this program is compiled and run, IDL prints:

```A_INVERT Identity Matrix:
1.0000000   1.7763568e-015  6.6613381e-016
0.00000000  1.0000000       1.2212453e-015
0.00000000  0.00000000      1.0000000
```

Introduced 5.6