vecl: Stack and Unstack Below-Diagonal Elements

View source: R/GFT.R

veclR Documentation

Stack and Unstack Below-Diagonal Elements

Description

vecl stacks the below-diagonal elements of a square matrix column by column. unvecl is its right inverse on symmetric matrices with zero diagonal: it forms the symmetric matrix with zero diagonal and below-diagonal elements z.

Usage

vecl(M)
unvecl(z)

Arguments

M

a square matrix.

z

a numeric vector of length n(n-1)/2 for some integer n.

Value

vecl returns a numeric vector of length n(n-1)/2. unvecl returns an n \times n symmetric numeric matrix with zero diagonal.

Examples

M <- matrix(1:9, 3, 3)
vecl(M)                 # c(2, 3, 6)
unvecl(c(0.1, 0.2, 0.3))

GFT documentation built on Aug. 23, 2026, 5:10 p.m.