lufactorized

compas.numerical.lufactorized(A)[source]

Return a function for solving a sparse linear system (LU decomposition).

Parameters:
Aarray

Matrix A represented as an (m x n) array.

Returns:
callable

Function to solve linear system with input matrix (n x 1).

Notes

LU decomposition factors a matrix as the product of a lower triangular and an upper triangular matrix L and U.

\[\mathbf{A} = \mathbf{L} \mathbf{U}\]

Examples

>>> fn = _lufactorized(array([[3, 2, -1], [2, -2, 4], [-1, 0.5, -1]]))
>>> fn(array([1, -2, 0]))
array([ 1., -2., -2.])