function is used in conjunction with the LUDC procedure to solve a set of
linear equations in
Ax = b
. The parameter
is input not as the original array, but as its
LU decomposition, created by the routine LUDC. The result is an
-element vector whose type is identical to
LUSOL is based on the routine
described in section 2.3 of
Numerical Recipes in C: The Art of Scientific Computing
(Second Edition), published by Cambridge University Press, and is used by permission.
Result = LUSOL(
A, Index, B
LU decomposition of an array 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.
-element vector containing the right-hand side of the linear system
Ax = b
Set this keyword if the input array
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.
To solve the linear system
Ax = b
using LU decomposition and back substitution:
A = [[ 2.0, 1.0, 1.0], $
[ 4.0, -6.0, 0.0], $
[-2.0, 7.0, 2.0]]
B = [3.0, -8.0, 10.0]
LUDC, A, INDEX
result = LUSOL(A, INDEX, B)
1.00000 2.00000 -1.00000
This is the exact solution vector.