Note: If you are working with complex inputs, use the LA_LUMPROVE function instead.
This example uses LUMPROVE to improve an approximate solution X to the linear system Ax = B:
; Create coefficient array A:
A = [[ 2.0, 1.0, 1.0], $
[ 4.0, -6.0, 0.0], $
[-2.0, 7.0, 2.0]]
; Create a duplicate of A:
alud = A
; Define the right-hand side vector B:
B = [3.0, -8.0, 10.0]
; Begin with an estimated solution X:
X = [.89, 1.78, -0.88]
; Decompose the duplicate of A:
LUDC, alud, INDEX
; Compute an improved solution:
result = LUMPROVE(A, alud, INDEX, B, X)
; Print the result:
1.00000 2.00000 -1.00000
This is the exact solution vector.
The result is a vector, whose type and length are identical to X, containing the improved solution.
The n by n coefficient array of the linear system Ax = b.
The n by n LU decomposition of A created by the LUDC procedure.
An input vector, created by the LUDC procedure, containing a record of the row permutations which occurred as a result of partial pivoting.
An n-element vector containing the right-hand side of the linear system
Ax = b.
An n-element vector containing the approximate solution of the linear system
Ax = b.
Set this keyword if the input array A is in column-major format (composed of column vectors) rather than in row-major format (composed of row vectors).
Set this keyword to force the computation to be done in double-precision arithmetic.
Resources and References
LUMPROVE is based on the routine mprove described in section 2.5 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), published by Cambridge University Press, and is used by permission.