Algorithm 8 follows the lead of our sources (see Section 6.3 for details) and implements a technique for updating the factors L, D, and U of A following a rank one change to A.
| for $i=1,\cdots,n$ |
| $\delta=d_{i}$ |
| $p=y_{i}$ |
| $q=z_{i}$ |
| $d_{i}=d_{i}+\alpha pq$ |
| $\beta_{1}=\displaystyle\frac{\alpha p}{d_{i}}$ |
| $\beta_{2}=\displaystyle\frac{\alpha q}{d_{i}}$ |
| $\alpha=\displaystyle\frac{\alpha\delta}{d_{i}}$ |
| for $j=i+1,\cdots,n$ |
| $y_{j}=y_{j}-pl_{ji}$ |
| $z_{j}=z_{j}-qu_{ij}$ |
| $l_{ji}=l_{ji}+\beta_{1}y_{j}$ |
| $u_{ij}=u_{ij}+\beta_{2}y_{j}$ |
The scalar $\alpha$< and the vectors $\mathbf{y}$ and $\mathbf{z^T}$ are destroyed by this procedure. The factors of $\mathbf{A}$ are overwritten by their new values.
The outer loop of Algorithm 8 does not have to begin at one unless y is full. If has any leading zeros, the initial value of i should be the index of yi the first nonzero element of y. If there is no a priori information about the structure of $\mathbf{y}$ but there is a high probability of leading zeros, testing y for zero at the beginning of the loop might save a lot of work. However, you must remember to cancel he test as soon as a nonzero yi is encountered.