19 lines
470 B
JavaScript
19 lines
470 B
JavaScript
module.exports = ldu
|
|
|
|
/**
|
|
* Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
|
|
*
|
|
* @alias mat2.ldu
|
|
* @param {mat2} L the lower triangular matrix
|
|
* @param {mat2} D the diagonal matrix
|
|
* @param {mat2} U the upper triangular matrix
|
|
* @param {mat2} a the input matrix to factorize
|
|
*/
|
|
function ldu(L, D, U, a) {
|
|
L[2] = a[2]/a[0]
|
|
U[0] = a[0]
|
|
U[1] = a[1]
|
|
U[3] = a[3] - L[2] * U[1]
|
|
return [L, D, U]
|
|
}
|