scijs/ndarray-ldl-factorization

Name: ndarray-ldl-factorization

Owner: scijs

Description: LDL Factorization for ndarrays

Created: 2015-05-02 04:48:32.0

Updated: 2017-05-31 20:34:58.0

Pushed: 2015-07-27 02:30:11.0

Homepage: null

Size: 220

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ndarray-ldl-factorization

NPM version Build Status Dependencies

LDL Decomposition for ndarrays

Installation
m install ndarray-ldl-factorization

For use in the browser, use browserify.

Usage
ldl = require( 'ndarray-ldl-factorization' );
ldl(A, L, d)

This function calculates the LDL decomposition of matrix A = LDL^t, where L is a lower-unit triangular matrix and D is a diagonal matrix. Consult the book Matrix computations (3rd ed.) by Gene H. Golub and Charles F. Van Loan for further information. The function takes L and d, the vector of diagonal elements of D, as arguments and changes them during execution. Note in particular the the upper triangular part of L is left untouched and so is not automatically zeroed.

ldl(A)

This function calculates the in-place LDL decomposition of matrix A = LDL^t. It is equivalent to ldl( A, A, diag(A) ) using diag = require('ndarray-diagonal').

Examples
ndarray = require('ndarray'),
show = require('ndarray-show'),
ldl = require( 'ndarray-ldl-factorization' ),
pool = require('ndarray-scratch');

A = ndarray(new Float64Array([9,-1,2,-1,8,-5,2,-5,7]), [3,3]);
L = pool.zeros( A.shape, A.dtype );
d = pool.zeros( [ A.shape[0] ], A.dtype);

A, L, d);

ole.log( 'A:\n' + show(A), '\n' );


.000   -1.000    2.000
.000    8.000   -5.000
.000   -5.000    7.000


ole.log( 'L:\n' + show(L) );


.000   -0.111    0.222
.000    1.000   -0.606
.000    0.000    1.000


ole.log( 'd:\n' + show(d) );


00    7.889    3.662

To run the example code from the top-level application directory,

de ./examples/index.js
Tests
Unit

Unit tests use the Tape test framework. To run the tests, execute the following command in the top-level application directory:

m test

License

MIT license.

Copyright

Copyright © 2015. Philipp Burckhardt.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.