incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r720730 - /incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java
Date Wed, 26 Nov 2008 04:00:29 GMT
Author: edwardyoon
Date: Tue Nov 25 20:00:29 2008
New Revision: 720730

URL: http://svn.apache.org/viewvc?rev=720730&view=rev
Log: (empty)

Modified:
    incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java

Modified: incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java?rev=720730&r1=720729&r2=720730&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java Tue Nov 25 20:00:29 2008
@@ -28,6 +28,7 @@
 import org.apache.hadoop.hbase.io.BatchUpdate;
 import org.apache.hadoop.hbase.io.Cell;
 import org.apache.hadoop.hbase.io.RowResult;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hama.algebra.BlockCyclicMultiplyMap;
@@ -478,4 +479,28 @@
   protected String getBlockKey(int i, int j) {
     return i + "," + j;
   }
+  
+  /**
+   * Using a scanner to block a dense matrix.
+   * 
+   * @param blockNum
+   * @throws IOException
+   */
+  public void blocking(int blockNum) throws IOException {
+    setBlockPosition(blockNum);
+    setBlockSize(blockNum);
+
+    String[] columns = new String[] { Constants.BLOCK_STARTROW,
+        Constants.BLOCK_ENDROW, Constants.BLOCK_STARTCOLUMN,
+        Constants.BLOCK_ENDCOLUMN };
+    Scanner scan = table.getScanner(columns);
+
+    for (RowResult row : scan) {
+      String[] key = Bytes.toString(row.getRow()).split("[,]");
+      int blockR = Integer.parseInt(key[0]);
+      int blockC = Integer.parseInt(key[1]);
+      setBlock(blockR, blockC, getBlock(blockR, blockC));
+    }
+  }
+
 }



Mime
View raw message