Home

Awesome

ndarray-lup-solve

Build Status npm version Dependency Status

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 = require('ndarray-lup-factorization'),
    solve = require('ndarray-lup-solve'),
    ndarray = require('ndarray'),
    pool = require('ndarray-scratch')

var A = ndarray([2,1,1,0, 4,3,3,1, 8,7,9,5, 6,7,9,8], [4,4])
var b = ndarray([13,38,102,107])
var P = []

// In-place LUP factorization:
//   Note: repeated A tells it L and U are both stored in A
lup(A, A, P)
solve( A, A, P, b)

// 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] )

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