Next: ... Up: Nested loops Previous: Nested loops

...

Consider the dependence equations:

for I1 = 0 to 3 do

  for I2 = 0 to 3 do
S:   A[I1,I2] := A[I1 - 1,I2] + A[I1,I2 - 1]
There are two potential dependences arising from the three references to A.

Therefore two systems of dependence equations to solve:

1.
 Between A[I11,I21] and A[I12 - 1,I22]:

\begin{displaymath}\left\{ \begin{array}{ccc}
I_1^1 & = & I_1^2-1 \\
I_2^1 & = & I_2^2
\end{array} \right.
\end{displaymath}

2.
  Between A[I11,I21] and A[I12,I22 - 1]:

\begin{displaymath}\left\{ \begin{array}{ccc}
I_1^1 = I_1^2 \\
I_2^1 = I_2^2-1
\end{array} \right.
\end{displaymath}

((strictly we should also consider output dependences between A[I11,I21] and A[I12,I22], but this is obviously absent)).