vec: Vectorize

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

View source: R/linearAlgebra-vec.R

Description

Vectorize a matrix.

Usage

1
vec(x)

Arguments

x

Matrix.

Details

The vectorization of an m \times n matrix \mathbf{A}, given by \mathrm{vec} ≤ft( \mathbf{A} \right) , is the mn \times 1 vector obtained by stacking the elements of \mathbf{A} column-wise.

Value

A vector.

Author(s)

Ivan Jacob Agaloos Pesigan

References

Wikipedia: Vectorization

Magnus, J. R., & Neudecker, H. (2019). Matrix differential calculus with applications in statistics and econometrics. Wiley. https://doi.org/10.1002/9781119541219

See Also

Other Vectorization Functions: diag_of_vech(), vec_mean(), vechnames(), vechsnames(), vechs(), vech()

Examples

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

vec(A)

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