Recognizing the special character of symmetric matrices can save time and storage during
the solution of linear systems. More specifically, a dense matrix requires storage for
n^{2} elements. A symmetric matrix can be stored in about half the space,
$\frac{{n}^{2}+n}{2}$ elements. Only the upper (or lower) triangular portion of
A has to be explicitly stored. The implicit portions of A
can be retrieved using Equation
57. An efficient data structure
for storing dense, symmetric matrices is a simple linear array. If the upper triangular
portion of A is retained, the array is organized in the following manner.

$\mathbf{A}=({a}_{11},{a}_{12},\cdots,{a}_{1n},{a}_{21},\cdots,{a}_{2n},\cdots,% {a}_{nn})$ | (66) |

The element a${}_{ij}$ is retrieved from the linear array by the following indexing rule.

$a_{ij}=\mathbf{a}\text{[}(i-1)(n)-(i-1)i/2+j\text{]}$ | (67) |

If array and matrix indexing is zero based (as in the C programming language), the subscripting rule becomes

$a_{ij}=\mathbf{a}\text{[}in-(i-1)i/2+j\text{]}$ | (68) |

If the lower triangular portion of A is retained, the linear array is organized as follows.

$\mathbf{A}=({a}_{11},{a}_{21},{a}_{22},{a}_{31},\cdots,{a}_{n1},{a}_{n2},% \cdots,{a}_{nn})$ | (69) |

The element a_{ij} is retrieved from the linear array by the following indexing rule.

$a_{ij}=\mathbf{a}\text{[}i(i-1)/2+j\text{]}$ | (70) |

If array and matrix subscripts are zero based, Equation 70 becomes

$a_{ij}=\mathbf{a}\text{[}i(i+1)/2+j\text{]}$ | (71) |

You will observe that the dimension of A does not enter the indexing calculation when its lower triangular portion is retained. The indexing equations are implemented most efficiently by replacing division by two with a right shift.