spd.vectorize: Vectorize and unvectorize a matrix

View source: R/spd-vectorize.R

spd.vectorizeR Documentation

Vectorize and unvectorize a matrix

Description

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.


areshenk/spdm documentation built on Aug. 5, 2023, 12:26 a.m.