A packed storage matrix, also known as packed matrix, is a term used in programming for representing an <math>m\times n</math> matrix. It is a more compact way than an m-by-n rectangular array by exploiting a special structure of the matrix.

Typical examples of matrices that can take advantage of packed storage include:

  • symmetric or hermitian matrix
  • Triangular matrix
  • Banded matrix.

Triangular packed matrices

The packed storage matrix allows a matrix to be converted to an array, shrinking the matrix significantly. In doing so, a square <math>n \times n</math> matrix is converted to an array of length .

Consider the following upper matrix:

:<math>\mathbf{U} = \begin{pmatrix}

a_{11} & a_{12} & a_{13} & a_{14} \\

& a_{22} & a_{23} & a_{24} \\

& & a_{33} & a_{34} \\

& & & a_{44} \\

\end{pmatrix}</math>

which can be packed into the one array:

:<math> \mathbf{UP} = (\underbrace{a_{11\ \underbrace{a_{12}\ a_{22\ \underbrace{a_{13}\ a_{23}\ a_{33\ \underbrace{a_{14},\ a_{24}\ a_{34}\ a_{44)

</math>

Similarly the lower matrix:

:<math>\mathbf{L} = \begin{pmatrix}

a_{11} & & & \\

a_{21} & a_{22} & & \\

a_{31} & a_{32} & a_{33} & \\

a_{41} & a_{42} & a_{43} & a_{44} \\

\end{pmatrix}.</math>

can be packed into the following one dimensional array:

:<math>

LP = (\underbrace{a_{11}\ a_{21}\ a_{31}\ a_{41\ \underbrace{a_{22}\ a_{32}\ a_{42\ \underbrace{a_{33}\ a_{43\ \underbrace{a_{44)

</math>