ndarray-crout-decomposition
LU decomposition using the crout algorithm
example
var ndarray = ;var zeros = ;var show = ;var crout = ;var A = ;var L = ;var U = ;;console;console;
output:
L=
4.000 0.000
3.000 -1.500
U=
1.000 1.500
0.000 1.000
or to save space, you can use a single matrix to store the L and U values:
var ndarray = ;var zeros = ;var show = ;var crout = ;var A = ;var LU = ;;console;
output:
LU=
4.000 1.500
3.000 -1.500
methods
var crout =
var ok = crout(A, L, U)
Decompose the matrix A
into L
and U
, mutating L
and U
in-place.
A
is not modified.
If you don't pass in a U
matrix, L
will be used to store both the L
and
U
values, omitting the diagonal of ones from U
to make room.
If A
was non-square or the algorithm could not find a solution, ok
is
false
. Otherwise ok
is true
.
install
With npm do:
npm install ndarray-crout-decomposition
license
MIT