Skip to contents

stm_tril() returns the lower triangular part of a matrix, optionally with a specified diagonal offset.

Usage

stm_tril(mat, k = 0)

Arguments

mat

A numeric matrix.

k

An integer indicating the diagonal to be used. Default is 0, which returns the lower triangular part including the main diagonal.

Value

A matrix containing the lower triangular part of mat, with the specified diagonal offset.

Details

This function calls stm_tri_lower_upper() to extract the lower triangular part of the matrix.

See also

Examples

A <- matrix(1:16, nrow = 4, byrow = TRUE)
print(A)
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    2    3    4
#> [2,]    5    6    7    8
#> [3,]    9   10   11   12
#> [4,]   13   14   15   16
stm_tril(A)
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    0    0    0
#> [2,]    5    6    0    0
#> [3,]    9   10   11    0
#> [4,]   13   14   15   16