ndarray-lup-solve
Solve ndarray Ax=b via LU factorization with pivoting
Introduction
Given an LUP factorization, this module solves for x in Ax = b. More precisely, it solves for x in LUx = Pb.
Example
var lup = solve = ndarray = pool = var A = var b = var P = // In-place LUP factorization:// Note: repeated A tells it L and U are both stored in A // b now contains the answer x: [2,5,4,3]// A and P are unchanged and can be re-used to solve another problem
Usage
require('ndarray-lup-solve')( L, U, P, b [, work] )
L
: The n x n ndarray lower-triangular portion of the LUP factorization. The diagonal entries are implicitly assumed to be 1. Unchanged by the algorithm.U
: The n x n ndarray upper-triangular portion of the LUP factorization. Unchanged by the algorithm.P
: AnArray
of length n containg the permutationb
: An ndarray of length n containing the righthand side of Ax = bwork
: (optional) A vector used to permute the entries. If not provided, it is allocated and released into anndarray-scratch
typed vector pool.
Returns true
on successful completion; false
otherwise.
require('ndarray-lup-solve')( LU, LU, P, b [, work] )
If the first two arguments are identical then it's understood that both L and U are stored in a single matrix with the diagonal entries of L (all unity) omitted. Usage and behavior is otherwise identical.
Credits
(c) 2015 Ricky Reusser. MIT License