Skip to contents

stm_triu_from_vector() generates an upper triangular matrix from a given vector. The function calls another matrix function to generate the matrix.

Usage

stm_triu_from_vector(vec)

Arguments

vec

A numeric vector. The vector from which the upper triangular matrix is created.

Value

An upper triangular matrix created from the input vector.

Details

This function relies on stm_matrix_lus() to generate the matrix.

Examples

v <- c(1, 2, 3, 4, 5, 6)
print(v)
#> [1] 1 2 3 4 5 6
stm_triu_from_vector(v)
#>      [,1] [,2] [,3]
#> [1,]    1    2    4
#> [2,]    0    3    5
#> [3,]    0    0    6