If A is a symmetric n × n matrix, Algorithm 12 computes – one column at a time – the lower triangular matrix L that results from Crout's LU decomposition. The lower triangular portion of A is overwritten by L.
for $j=1,\cdots,n$ |
for $i=1,\cdots,j-1$ |
$w_{i}=\displaystyle\frac{a_{ji}}{a_{ii}}$ |
for $i=j,\cdots,n$ |
$\alpha=a_{ij}$ |
for $p=1,\cdots,j-1$ |
$\alpha=\alpha-a_{ip}w_{p}$ |
$a_{ij}=\alpha$ |
The algorithm uses a working vector w of length n to construct the relevant portion of column j from U at each stage of the factorization. Elements from U are derived using Equation 79.
If the lower triangular portion of A is stored in a linear array, Algorithm 13 results in the same factorization (assuming zero based subscripting). The algorithm overwrites A with L.
for $j=0,\cdots,n-1$ |
for $i=0,\cdots,j-1$ |
$\mathbf{w}[j]=\displaystyle\frac{\mathbf{a}{[jn-j(j+1)/2+i]}}{% \mathbf{a}{[jn-j(j+1)/2+j]}}$ |
for $i=j,\cdots,n-1$ |
$\alpha=\mathbf{a}{[i(i+1)/2+j]}$ |
for $p=1,\cdots,i-1$ |
$\alpha=\alpha\cdot\mathbf{a}[i(i+1)/2+p]\cdot\mathbf{w}[p]$ |
$\mathbf{a}[i(i+1)/2+j] = \alpha$ |
For the general implementation of Crout’s method, see Section 4.3.