lib/ops.js
function tril(A, k) {
    if (k === void 0) { k = 0; }
    if (A.shape.length !== 2) {
        throw new Error('Input is not matrix');
    }
    var copyA = A.clone();
    for (var i = 0; i < copyA.shape[0]; i++) {
        for (var j = 0; j < copyA.shape[1]; j++) {
            if (i < j - k) {
                copyA.set(i, j, 0);
            }
        }
    }
    return copyA;
}
function tril(A, k) {
    if (k === void 0) { k = 0; }
    if (A.shape.length !== 2) {
        throw new Error('Input is not matrix');
    }
    var copyA = A.clone();
    for (var i = 0; i < copyA.shape[0]; i++) {
        for (var j = 0; j < copyA.shape[1]; j++) {
            if (i < j - k) {
                copyA.set(i, j, 0);
            }
        }
    }
    return copyA;
}
function tril ( A , k ) { if ( k === void 0 ) { k = 0 ; } if ( A . shape . length !== 2 ) { throw new Error ( 'Input is not matrix' ) ; } var copyA = A . clone ( ) ; for ( var i = 0 ; i < copyA . shape [ 0 ] ; i ++ ) { for ( var j = 0 ; j < copyA . shape [ 1 ] ; j ++ ) { if ( i < j - k ) { copyA . set ( i , j , 0 ) ; } } } return copyA ; }
Create Lower triangular matrix from given matrix
Create Lower triangular matrix from given matrix