March 12, 2009

Find the maximum absolute row sum of matrix using MapReduce

The find the maximum absolute row sum of matrix is a good fit with MapReduce model as below.

The maximum absolute row sum = max ( sum | a_{i,j} | )
1<=i<=n j=1

- A map task receives a row n as a key, and vector of each row as its value
- emit (row, the sum of the absolute value of each entries)
- Reduce task select the maximum one

Maybe it can be written in java as below.

Vector v = givenValue;

double rowSum;
for(VectorEntry e : v) {
rowSum += Math.abs(e.get(i));

See more of the Hama - Algorithms


  1. Jon Stevens
    Add as Friend
    Today at 5:26am
    Report Message
    i can't comment on your blog cause the word verification image shows up as a broken image. but, what i wanted to ask is on this page:

    wouldn't it be e.get(i) in your example?

  2. Jon, Thanks for your comment, I fixed it. ;)