incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hama Wiki] Trivial Update of "MatMult" by udanax
Date Mon, 16 Feb 2009 04:36:48 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hama Wiki" for change notification.

The following page has been changed by udanax:
http://wiki.apache.org/hama/MatMult

------------------------------------------------------------------------------
  
      @Override
      public void map(IntWritable key, MapWritable value,
-         OutputCollector<BlockID, VectorWritable> output, Reporter reporter)
+         OutputCollector<BlockID, MapWritable> output, Reporter reporter)
          throws IOException {
+       int startColumn, endColumn, blkRow = key.get() / mBlockRowSize, i = 0;
-       int startColumn;
-       int endColumn;
-       int blkRow = key.get() / mBlockRowSize;
        this.value = value;
+       
- 
-       int i = 0;
        do {
          startColumn = i * mBlockColSize;
          endColumn = startColumn + mBlockColSize - 1;
          if (endColumn >= mColumns) // the last sub vector
            endColumn = mColumns - 1;
-         output.collect(new BlockID(blkRow, i), new VectorWritable(key.get(),
+         output.collect(new BlockID(blkRow, i), subVector(key.get(), startColumn, endColumn));
-             subVector(startColumn, endColumn)));
  
          i++;
        } while (endColumn < (mColumns - 1));
      }
  
-     private DenseVector subVector(int i0, int i1) {
+     private MapWritable subVector(int row, int i0, int i1) {
        DenseVector res = new DenseVector();
+       res.setRow(row);
+       
        for (int i = i0; i <= i1; i++) {
          res.set(i, ((DoubleWritable) this.value.get(new IntWritable(i))).get());
        }
  
-       return res;
+       return res.getEntries();
      }
    }
  

Mime
View raw message