incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r701976 - in /incubator/hama/trunk/src/java/org/apache/hama: AbstractVector.java DenseMatrix.java DenseVector.java
Date Mon, 06 Oct 2008 07:44:03 GMT
Author: edwardyoon
Date: Mon Oct  6 00:44:03 2008
New Revision: 701976

URL: http://svn.apache.org/viewvc?rev=701976&view=rev
Log:
Trivial changes.

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

Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java?rev=701976&r1=701975&r2=701976&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractVector.java Mon Oct  6 00:44:03
2008
@@ -41,9 +41,14 @@
    * @return iterator
    */
   public Iterator<VectorEntry> iterator() {
-    return entries.values().iterator();
+    return this.entries.values().iterator();
   }
   
+  /**
+   * Returns a size of vector
+   * 
+   * @return a size of vector
+   */
   public int size() {
     return this.entries.size();
   }

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=701976&r1=701975&r2=701976&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java Mon Oct  6 00:44:03 2008
@@ -20,12 +20,14 @@
 package org.apache.hama;
 
 import java.io.IOException;
+import java.util.Map;
 
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Scanner;
+import org.apache.hadoop.hbase.io.Cell;
 import org.apache.hadoop.hbase.io.RowResult;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.mapred.JobConf;
@@ -155,7 +157,15 @@
   }
 
   public DenseVector getRow(int row) throws IOException {
-    return new DenseVector(table.getRow(String.valueOf(row)));
+    VectorMapWritable<Integer, VectorEntry> values = new VectorMapWritable<Integer,
VectorEntry>();
+    RowResult rowResult = table.getRow(String.valueOf(row));
+
+    for (Map.Entry<byte[], Cell> f : rowResult.entrySet()) {
+      VectorEntry entry = new VectorEntry(f.getValue());
+      values.put(Numeric.getColumnIndex(f.getKey()), entry);
+    }
+
+    return new DenseVector(values);
   }
 
   public Vector getColumn(int column) throws IOException {
@@ -180,8 +190,8 @@
     JobConf jobConf = new JobConf(config);
     jobConf.setJobName("multiplication MR job : " + result.getName());
 
-    Mult1DLayoutMap.initJob(this.getName(), B.getName(),
-        Mult1DLayoutMap.class, IntWritable.class, VectorWritable.class, jobConf);
+    Mult1DLayoutMap.initJob(this.getName(), B.getName(), Mult1DLayoutMap.class,
+        IntWritable.class, VectorWritable.class, jobConf);
     MatrixReduce.initJob(result.getName(), Mult1DLayoutReduce.class, jobConf);
     JobManager.execute(jobConf, result);
     return result;

Modified: incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java?rev=701976&r1=701975&r2=701976&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/DenseVector.java Mon Oct  6 00:44:03 2008
@@ -20,14 +20,10 @@
 package org.apache.hama;
 
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Set;
 
-import org.apache.hadoop.hbase.io.Cell;
-import org.apache.hadoop.hbase.io.RowResult;
 import org.apache.hama.io.VectorEntry;
 import org.apache.hama.io.VectorMapWritable;
-import org.apache.hama.util.Numeric;
 import org.apache.log4j.Logger;
 
 public class DenseVector extends AbstractVector implements Vector {
@@ -41,14 +37,6 @@
     this.entries = m;
   }
 
-  public DenseVector(RowResult rowResult) {
-    this.entries = new VectorMapWritable<Integer, VectorEntry>();
-    for (Map.Entry<byte[], Cell> f : rowResult.entrySet()) {
-      VectorEntry entry = new VectorEntry(f.getValue());
-      this.entries.put(Numeric.getColumnIndex(f.getKey()), entry);
-    }
-  }
-
   public Vector add(double alpha, Vector v) {
     // TODO Auto-generated method stub
     return null;



Mime
View raw message