next up previous
Next: Exercise 10. Up: Final-2003 Previous: Exercise 8.

Exercise 9.

The goal of this exercice is to translate into three-address code a C-like piece of code for the multiplications of two square matrices. To do so we assume that our three-address code implemnts arrays like in C. A part from that, the three-address code instructions you may need are of one of the usual forms: Moreover your solution does not need to be obtained by one of the algorithms of the course. Just consider that you are programming a very basic calculator. Here's the C-like piece of code we want to translate.
for (i=0; i<n; i++) {
    for (j=0; j<n; j++) {
        c[i,j] = 0;
        for (k=0; k<n; k++) {
            c[i,j] = c[i,j] + a[i,k] * b[k,j];
        }
    }
}

Answer 9  
\fbox{
\begin{minipage}{12 cm}
\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\mbox{ } \...
...\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\mbox{ } \\
\end{minipage}}


next up previous
Next: Exercise 10. Up: Final-2003 Previous: Exercise 8.
Marc Moreno Maza
2004-12-02