written 5.6 years ago by
teamques10
★ 68k
|
•
modified 5.6 years ago
|
Let A and B be the two metrics to be multiplied and result be matrix C.
Matrix A has dimension L, M and matrix . has dimension M, N
- Map phase.
For each element (i, j) of A, emit ( ( i, k), A [i, j] ) for K in 1,......N
For each element (j , k) of B, emit ( (j, k) , B[j, k) for j in 1,.....L
- Reduce phase.
In reduce phase emit
key (i, k)
value = sum j ( A [i, i] * B [j, k])
sym j ( A [ i, j * B ( [ j, k])
- The block diagram of two stage map reduce multiplication algorithm can be shown as follows:
- Pseudo-code for the algorithm is as follows:
map (key values)
for ( i, k aij) in valve:
emit (i, aij * v [j] )
reduce (key values)
result = 0
for valve in values:
result + = valve
emit (key, result)