
256 CHAPTER 12. MATRIX OPERATIONS
Consider the node that has the responsibility for calculating block (i,j) of
the product C, which it calculates as
C
ij
= A
i1
B
1j
+ A
i2
B
2j
+ ... + A
ii
B
ij
+ ... + A
i,m
B
m,j
(12.13)
It will be convenient here (only in this section) to number rows and columns
starting at 0 instead of 1, as the code uses the mod operator based on that
setting. Now rearrange (12.13) with A
ii
first:
A
ii
B
ij
+A
i,i+1
B
i+1,j
+...+A
i,m−1
B
m−1,j
+A
i0
B
0j
+A
i1
B
1j
+...+A
i,i−1
B
i−1,j
(12.14)
The algorithm is then as follows. The node which is handling the compu-
tation of C
ij
does this (in parallel with the other nodes which are working
with their own values of i and