Cholesky Tools
Basic operations for symmetric positive definite matrices.
Installation
npm install cholesky-tools
Usage
The following functions are provided: cholesky
, determinant
and inverse
.
They assume the input parameter is symmetric positive definite matrix. Some
functions accept second optional parameter choleskyL
. If provided, function
might use it for performance boost.
For performance reasons there is no input validation. It is up to user to insure valid input.
The following example shows all the functionality.
const ct = ; // define symmetric positive definite matrixvar A = 4 -2 -2 2; // calculate cholesky decomposition, the result is lower triangular matrixvar L = ct; // [[2, 0], [-1, 1]] // calculate inversevar Ainv = ct; // [[0.5, 0.5], [0.5, 1]] // calculate inverse with providing cholesky decomposition matrix L.// L must be lower triangularvar Ainv2 = ct; // [[0.5, 0.5], [0.5, 1]] // calculate determinantvar det = ct; // 4 // calculate determinant with providing cholesky decomposition matrix L.// L must be lower triangularvar det2 = ct; // 4
License
This software is released under the MIT license.