Contents
Derivation of LU Factorization Unblocked Variant 1
Operation to be computed:
where
and
are vectors of the same length, and
is their dot product (a scalar). We start with the blank worksheet
Step 1: Precondition and Postcondition
The precondition is given by the predicate
where
denotes the original contents of
and is a dummy variable. The postcondition is given by the predicate ![\[
\alpha = x^T y + \hat{\alpha}.
\] \[
\alpha = x^T y + \hat{\alpha}.
\]](/wiki/LA.wiki/Apdot/Derivation/UnbVar1?action=AttachFile&do=get&target=latex_d6ed4b2cc56e17da7f87dbd4df1e38f210111265_p1.png)
These conditions are entered in the worksheet as Step 1a and 1b, as in
Step 2: Determine Loop-Invariants
As the computation progresses, the algorithms will sweep through the vectors exposing partitions:
where
and
are both vectors and of equal size.
To determine loop-invariants, we take these partitioned vectors and substitute them into the postcondition:
Manipulating this term yeilds
Depending on whether we choose to start from the top or the bottom of the vectors
and
, we find that
can, at an intermediate stage, be in one of the following two states:
Invariant 1 |
|
Invariant 2 |
|
We will pick Invariant 1 for our subsequent discussion, which is entered in the worksheet as in
Step 3: Determine the Loop-Guard
Next we determine the loop-guard
. Note that
must imply the postcondition. Taking
has this property.
The loop-guard is entered as Step 3, in
Step 4: Determine the Initialization
Now we determine an initialization that puts
in a state where the loop-invariant is true. The partitioning 
with
and
both empty (
) has the desired property. This is entered as Step 4, in
Step 5: Progressing through the Matrices
The initialization sets the top partitions to
while the loop-guard indicates that the loop completes when these same paritions envelop the entire vectors. Thus, the algorithm must march through the vectors in a way that grows the top partition. Since we are trying to derive an unblocked algorithm, we choose to expose columns at the top of the loop that are then moved to the other side of the thick lines at the bottom of the loop, as in 
Step 6: State after Repartitioning
The statement Repartition ... with ... exposes subvectors. We determine what the state of
is in terms of these subvectors via textual substitution into the loop-invariant.
The repartitioning step
can be substitued into the loop-invariant, yielding
This is then entered in Step 6, in
Step 7: State after Moving the Lines
The statement Continue with ... redefines the quadrants. We determine what the state of matrix The Continue with ...
must be if the loop-invariant is to again hold at the bottom of the loop, again via textual substitution into the loop-invariant.
Substituting these into the loop-invariant yields
This is then entered in Step 7, in
Step 8: Determining the Update
The question now becomes how to update the contents of matrix
from
to
This justifies the update
which is entered as Step 8, in
Final Algorithm
By eliminating all references to the dummy variables
, the algorithm for computing Apdot is left: 

![\[
\alpha \becomes APDOT(x, y, \alpha)
\] \[
\alpha \becomes APDOT(x, y, \alpha)
\]](/wiki/LA.wiki/Apdot/Derivation/UnbVar1?action=AttachFile&do=get&target=latex_dfa63b7e08a07fc0d2f6b92a6b764202df44b598_p1.png)

![\[
\alpha = \hat{\alpha},
\] \[
\alpha = \hat{\alpha},
\]](/wiki/LA.wiki/Apdot/Derivation/UnbVar1?action=AttachFile&do=get&target=latex_f2ad6a15bdb3e26dd07d3ce57949b7963d46db55_p1.png)


![\[
\alpha = x_{T}^T y_{T} + y_{B}^T y_{B} + \hat{\alpha}.
\] \[
\alpha = x_{T}^T y_{T} + y_{B}^T y_{B} + \hat{\alpha}.
\]](/wiki/LA.wiki/Apdot/Derivation/UnbVar1?action=AttachFile&do=get&target=latex_0f42730c574d83c215df185f05f7c6c9435dfba8_p1.png)
![\[
\alpha = \tr{x}_T y_T + \hat{\alpha}
\] \[
\alpha = \tr{x}_T y_T + \hat{\alpha}
\]](/wiki/LA.wiki/Apdot/Invariants/Inv1?action=AttachFile&do=get&target=latex_fbf6231dcf448676d29390bf1db26800806d6ed2_p1.png)
![\[
\alpha = \tr{x}_B y_B + \hat{\alpha}
\] \[
\alpha = \tr{x}_B y_B + \hat{\alpha}
\]](/wiki/LA.wiki/Apdot/Invariants/Inv2?action=AttachFile&do=get&target=latex_f967c005c78381e0f1dab4e0fda9ca27a204cc00_p1.png)

![\[
\left(
\alpha = \tr{x}_T y_T + \hat{\alpha}
~ \wedge ~ 0 \leq m( x_T ) = m( y_T ) \leq m( x )
\right)
\wedge \neg G
\] \[
\left(
\alpha = \tr{x}_T y_T + \hat{\alpha}
~ \wedge ~ 0 \leq m( x_T ) = m( y_T ) \leq m( x )
\right)
\wedge \neg G
\]](/wiki/LA.wiki/Apdot/Derivation/UnbVar1?action=AttachFile&do=get&target=latex_0d5bc3462cf730c8526d35decf0344c389b15f84_p1.png)








![\[
x_0^T y_0 + \hat{\alpha}
\] \[
x_0^T y_0 + \hat{\alpha}
\]](/wiki/LA.wiki/Apdot/Derivation/UnbVar1?action=AttachFile&do=get&target=latex_b3e63f01dd6c5b8ca1ef76e68232fe6d99742d6d_p1.png)
![\[
x_0^T y_0 + \chi_1 \psi_1 + \hat{\alpha}
\] \[
x_0^T y_0 + \chi_1 \psi_1 + \hat{\alpha}
\]](/wiki/LA.wiki/Apdot/Derivation/UnbVar1?action=AttachFile&do=get&target=latex_9435320a00b4ed2723268e6506ec576ac533f623_p1.png)
![\[
\begin{array}{l}
\alpha \becomes \chi_1 \psi_1 + \alpha
\end{array}
\] \[
\begin{array}{l}
\alpha \becomes \chi_1 \psi_1 + \alpha
\end{array}
\]](/wiki/LA.wiki/Apdot/Derivation/UnbVar1?action=AttachFile&do=get&target=latex_e6b48b94979884582070ae1f08b1b6c825bd3ea4_p1.png)
