SYMSQR Function

SYMSQR (matrix) ;

The SYMSQR function takes an $n \times n$ numeric matrix and packs the elements from the lower triangular portion into a column vector that contains $n(n+1)/2$ rows. The matrix is not checked for symmetry, but usually matrix is a symmetric matrix.

The following statement produces the output shown in Figure 23.350:

sym = symsqr({1 2, 3 4});
print sym;

Figure 23.350: Elements of Lower Triangular Matrix

sym
1
3
4


Notice that the $(1,2)$ element is lost since it is only present in the upper triangular portion of the input matrix.

The SYMSQR function and the SQRSYM function are inverse operations on the set of symmetric matrices. See also the VECH function, which unpacks elements in column-major order.