Next: ... Up: Ch05-CompilerIssues Previous: ...

   
Matrix representation of loop transformations

To skew the inner loop by the outer loop by factor 1 we adjust the loop bounds, and replace I1 by K1, and I2 by K2-K1. That is,

\begin{displaymath}(K_1,K_2) = (I_1,I_2) \cdot {\bf U}
\end{displaymath}

where U is a $2 \times 2$ matrix

\begin{displaymath}\left[ \begin{array}{cc}
1 & 1 \\
0 & 1
\end{array} \right]
\end{displaymath}

That is,

\begin{displaymath}(K_1,K_2) = (I_1,I_2) \cdot {\bf U} = (I_1,I_2+I_1)
\end{displaymath}

The inverse gets us back again:

\begin{displaymath}(I_1,I_2) = (K_1,K_2) \cdot {\bf U}^{-1} = (K_1,K_2-K_1)
\end{displaymath}