Language Reference


SYMSQR Function

SYMSQR (matrix);

The SYMSQR function takes an $n \times n$ 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 numeric matrix. Character matrices are also supported.

The following statement produces the output shown in FigureĀ 24.407:

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

Figure 24.407: 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.