Skip to contents

Function converts between a square symmetric matrix and a vector of the lower triangular elements + diagonal. Allows optional scaling of the off-diagonal entries in order to preserve the norm.

Usage

spd.vectorize(x, scaling = F)

Arguments

x

Either a square matrix, or a vector contains the lower triangular elements of x (including the diagonal elements)

scaling

If TRUE, scales the off diagonal elements by sqrt(2) to preserve the norm of the resulting vector

Details

If input is a square matrix, converts the lower triangular elements (including the diagonal) into a numeric vector. If input is a numeric vector, converts the input to a symmetric matrix. Note that, if the input is a vector, its length must be a triangular number.