R/vech.R

Defines functions vech

Documented in vech

vech <- function( x )
{
###
### returns a stack of the lower triangular matrix as a matrix with 1 column
###
### Parameters
### x = a numeric matrix square matrix
###
    if ( !is.square.matrix( x ) )
        stop( "argument x is not a square numeric matrix" )
    return( t( t( x[!upper.tri(x)] ) ) )
}

Try the matrixcalc package in your browser

Any scripts or data that you put into this service are public.

matrixcalc documentation built on Sept. 15, 2022, 1:05 a.m.