## LUSOL

The LUSOL function is used in conjunction with the LUDC procedure to solve a set of n linear equations in n unknowns Ax = b. The parameter A is input not as the original array, but as its LU decomposition, created by the routine LUDC.

LUSOL is based on the routine `lubksb` 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.

 Note
If you are working with complex inputs, use the LA_LUSOL function instead.

### Syntax

Result = LUSOL(A, Index, B [, /COLUMN] [, /DOUBLE])

### Return Value

The result is an n-element vector whose type is identical to A.

### Arguments

#### A

The n by n LU decomposition of an array created by the LUDC procedure.

#### Index

An input vector, created by the LUDC procedure, containing a record of the row permutations which occurred as a result of partial pivoting.

#### B

An n-element vector containing the right-hand side of the linear system Ax = b.

### Keywords

#### COLUMN

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).

#### DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

### Examples

This example solves the linear system Ax = b using LU decomposition and back substitution:

```; Define array A:
A = [[ 2.0,  1.0,  1.0], \$
[ 4.0, -6.0,  0.0], \$
[-2.0,  7.0,  2.0]]

; Define right-hand side vector B:
B = [3.0, -8.0, 10.0]

; Decompose A:
LUDC, A, INDEX

; Compute the solution using back substitution:
result = LUSOL(A, INDEX, B)

; Print the result:
PRINT, result
```

IDL prints:

```  1.00000   2.00000   -1.00000
```

This is the exact solution vector.

### Version History

Introduced: Pre 4.0