vech: Half-Vectorize

Description Usage Arguments Details Value Dependencies Author(s) References See Also Examples

View source: R/linearAlgebra-vech.R

Description

Half-vectorize a symmetric matrix.

Usage

1
vech(x, names = FALSE, sep = ".")

Arguments

x

Matrix.

names

Logical. Add names.

sep

Character string. Separator for variable names.

Details

Generates an m(m + 1) / 2 vector from the unique elements of an m \times m symmetric matrix by stacking the columns (column-major).

Value

A vector.

Dependencies

Author(s)

Ivan Jacob Agaloos Pesigan

References

Wikipedia: Half-vectorization

See Also

Other Linear Algebra Functions: dcap(), kcap(), sym_of_vech(), vechnames()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- matrix(
  data = c(
    1.0, 0.5, 0.4,
    0.5, 1.0, 0.6,
    0.4, 0.6, 1.0
  ),
  ncol = 3
)

vech(x)

jeksterslab/gammaMatrix documentation built on Dec. 20, 2021, 10:10 p.m.