Class: LU

LinearAlgebra. LU


new LU()

This class represents a LU factorization of a square SparseMatrix. The factorization
is computed on the first call to solveSquare, and is reused in subsequent calls
to solveSquare (e.g. when only the right hand side b of the linear system Ax = b
changes) unless the sparse matrix itself is altered through operations such as
*=, += and -=. Do not use the constructor to initialize this class, instead
access the LU factorization of a sparse matrix directly from the matrix itself.

Example
// solve the linear system Ax = b, where A is a square sparse matrix
let A = SparseMatrix.identity(5, 5);
let b = DenseMatrix.ones(5, 1);

let lu = A.lu();
let x = lu.solveSquare(b);

b.scaleBy(5);
x = lu.solveSquare(b); // factorization is reused

Methods


solveSquare(b)

Solves the linear system Ax = b, where A is a square sparse matrix.

Parameters:
Name Type Description
b module:LinearAlgebra.DenseMatrix

The dense right hand side of the linear system Ax = b.

Returns:
Type
module:LinearAlgebra.DenseMatrix