INVERT
The INVERT function uses LU decomposition (via LA_INVERT) to compute the inverse of a square array. Errors from singular or near-singular arrays are accumulated in the optional Status argument.
Examples
; Create an array A:
A = [[ 5.0, -1.0, 3.0], $
[ 2.0, 0.0, 1.0], $
[ 3.0, 2.0, 1.0]]
result = INVERT(A)
; We can check the accuracy of the inversion by multiplying the
; inverted array by the original array. The result should be a 3 x
; 3 identity array.
PRINT, result # A
IDL prints:
1.00000 0.00000 0.00000
0.00000 1.00000 0.00000
0.00000 9.53674e-07 1.00000
Syntax
Result = INVERT( Array [, Status] [, /DOUBLE] )
Return Value
The result is a single- or double-precision array of floating-point or complex values. If Array is of type integer or type float then the result will be type float (unless the DOUBLE keyword is set). If Array is complex then the result will be complex (either single or double precision depending upon the input type and the DOUBLE keyword).
Arguments
Array
The array to be inverted. Array must have two dimensions of equal size (i.e., a square array) and can be of any type except string.
Status
A named variable to receive the status of the operation. Possible status values are:
- 0 = Successful completion.
- 1 = Singular array (which indicates that the inversion is invalid).
- 2 = Warning that a small pivot element was used and that significant accuracy was probably lost.
Keywords
DOUBLE
Set this keyword to force the computation to be done in double-precision arithmetic.
Version History
Original |
Introduced |
8.8.1 |
Changed algorithm to use LA_INVERT |