tril: Extract Lower Triangular Matrix

Description Usage Arguments Examples

Description

Extract the lower triangular part of a matrix.

Usage

1
tril(x, k = 0, diag = TRUE)

Arguments

x

A matrix.

k

Diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above.

diag

Logical indicating whether to include the diagonal. Default is TRUE.

Examples

1
2
tril(ones(5, 5))
tril(ones(5, 5), diag = TRUE)

Example output

Attaching package: 'ramify'

The following object is masked from 'package:graphics':

    clip

     [,1] [,2] [,3] [,4] [,5]
[1,]    1    0    0    0    0
[2,]    1    1    0    0    0
[3,]    1    1    1    0    0
[4,]    1    1    1    1    0
[5,]    1    1    1    1    1
     [,1] [,2] [,3] [,4] [,5]
[1,]    1    0    0    0    0
[2,]    1    1    0    0    0
[3,]    1    1    1    0    0
[4,]    1    1    1    1    0
[5,]    1    1    1    1    1

ramify documentation built on May 2, 2019, 5:58 a.m.