LUBKSB Procedure

Solves the set of n linear equations Ax = b. (LUBKSB must be used with the procedure LUDCMP to do this.)

Usage

    LUBKSB, a, index, b

Input Parameters

a—The LU decomposition of a matrix, created by LUDCMP. Parameter a is not modified by calling this procedure.

index—A vector, created by LUDCMP, containing the row permutations effected by the partial pivoting.

b—On input, b contains the vector on the right-hand side of the equation. Must be of data type FLOAT; other data types will cause incorrect output.

Output Parameters

b—On output, b is replaced by the solution, vector x.

Keywords

None.

Discussion

LUBKSB must be used in conjunction with LUDCMP.

Example

b = [ [1.0, -1.0, 3.0], [2.0, 1.0, 3.0], [3.0, 3.0, 1.0] ]
r = [3.0, 0.0, 6.0]
PM, Title='matrix b', b
PM, Title='vector r', r
PM, 'Make copies of b and r since they will get overwritten;'
a = b
q = r
PM, 'Find the LU factors of b;'
LUDCMP, a, i, d
PM, 'Use the LU factors to solve the system b#x=r;'
LUBKSB, a, i, q
PM, Title='Solution vector', q
PM, Title='Verify the solution by printing b#q', b#q

See Also

LUDCMP,  MPROVE

LUBKSB is based on the routine of the same name in Numerical Recipes in C: The Art of Scientific Computing, by Flannery, Press, Teukolsky, and Vetterling, Cambridge University Press, Cambridge, MA, 1988. It is used by permission.