A × B = C cij = ∑k=1,2,...,n aik × ckj
of the format ( keyi , valuei )
( key1 , value1 ) ( key2 , value2 ) ( key3 , value3 ) ...
Graphically:
( (A, 1, 1) , a11 ) ( (A, 1, 2) , a12 ) ( (A, 1, 3) , a13 ) ... ( (B, 1, 1) , b11 ) ( (B, 1, 2) , b12 ) ( (B, 1, 3) , b13 ) ...
(A, i, j), x) ---> ( (i,1), x ) ( (i,2), x ) .... ( (i,N), x ) (B, i, j), x) ---> ( (1,j), x ) ( (2,j), x ) .... ( (N,j), x )
wher N = # rows in matrix A (= # columnss in matrix B)
Example:
(This detail was omitted for brevity --- figure is kinda full)
sum = 0; for ( pos = 1 to N ) do { x = first value at position pos y = second value at position pos sum = sum + x*y; }