# Function lusolve #

Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.

## Syntax #

math.lusolve(A, b)     // returns column vector with the solution to the linear system A * x = b
math.lusolve(lup, b)   // returns column vector with the solution to the linear system A * x = b, lup = math.lup(A)

### Parameters #

Parameter Type Description
A Matrix | Array | Object Invertible Matrix or the Matrix LU decomposition
b Matrix | Array Column Vector
order number The Symbolic Ordering and Analysis order, see slu for details. Matrix must be a SparseMatrix
threshold Number Partial pivoting threshold (1 for partial pivoting), see slu for details. Matrix must be a SparseMatrix.

### Returns #

Type Description
DenseMatrix | Array Column vector with the solution to the linear system A * x = b

## Examples #

const m = [[1, 0, 0, 0], [0, 2, 0, 0], [0, 0, 3, 0], [0, 0, 0, 4]]

const x = math.lusolve(m, [-1, -1, -1, -1])        // x = [[-1], [-0.5], [-1/3], [-0.25]]

const f = math.lup(m)
const x1 = math.lusolve(f, [-1, -1, -1, -1])       // x1 = [[-1], [-0.5], [-1/3], [-0.25]]
const x2 = math.lusolve(f, [1, 2, 1, -1])          // x2 = [[1], [1], [1/3], [-0.25]]

const a = [[-2, 3], [2, 1]]
const b = [11, 9]
const x = math.lusolve(a, b)  // [[2], [5]]