incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r910562 - in /incubator/hama/trunk: CHANGES.txt conf/hama-env.sh src/examples/org/apache/hama/examples/MatrixAddition.java
Date Tue, 16 Feb 2010 15:29:27 GMT
Author: edwardyoon
Date: Tue Feb 16 15:29:27 2010
New Revision: 910562

URL: http://svn.apache.org/viewvc?rev=910562&view=rev
Log:
Example fail when performing sparse matrices addition

Modified:
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/conf/hama-env.sh
    incubator/hama/trunk/src/examples/org/apache/hama/examples/MatrixAddition.java

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=910562&r1=910561&r2=910562&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Tue Feb 16 15:29:27 2010
@@ -136,6 +136,7 @@
 
   BUG FIXES
  
+    HAMA-238: Example fail when performing sparse matrices addition (edwardyoon)
     HAMA-225: Jacobi iteration is in a infinite loop (edwardyoon)
     HAMA-214: Can't run the examples (edwardyoon)
     HAMA-190: Bug in Matrix-Vector multiplication (edwardyoon)

Modified: incubator/hama/trunk/conf/hama-env.sh
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/conf/hama-env.sh?rev=910562&r1=910561&r2=910562&view=diff
==============================================================================
--- incubator/hama/trunk/conf/hama-env.sh (original)
+++ incubator/hama/trunk/conf/hama-env.sh Tue Feb 16 15:29:27 2010
@@ -22,19 +22,19 @@
 # Set environment variables here.
 
 # The java implementation to use.  Required.
-export JAVA_HOME=/usr/java/jdk1.6.0_10
+# export JAVA_HOME=/usr/java/jdk1.6.0_18
 
 # hadoop conf dir. to find the mapreduce cluster.
-export HADOOP_CONF_DIR=/usr/local/src/hadoop-0.20.1/conf
+# export HADOOP_CONF_DIR=/usr/local/src/hadoop-0.20.1/conf
 
 # hbase conf dir. to find the hbase cluster.
-export HBASE_CONF_DIR=/usr/local/src/hbase-0.20.0/conf
+# export HBASE_CONF_DIR=/usr/local/src/hbase-0.20.3/conf
 
 # Extra Java CLASSPATH elements.  Optional.
-export HAMA_CLASSPATH=$HADOOP_CONF_DIR:$HBASE_CONF_DIR
+# export HAMA_CLASSPATH=$HADOOP_CONF_DIR:$HBASE_CONF_DIR
 
 # The maximum amount of heap to use, in MB. Default is 1000.
-export HBASE_HEAPSIZE=1000
+# export HBASE_HEAPSIZE=1000
 
 # Where log files are stored.  $HAMA_HOME/logs by default.
 # export HAMA_LOG_DIR=${HAMA_HOME}/logs

Modified: incubator/hama/trunk/src/examples/org/apache/hama/examples/MatrixAddition.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/examples/org/apache/hama/examples/MatrixAddition.java?rev=910562&r1=910561&r2=910562&view=diff
==============================================================================
--- incubator/hama/trunk/src/examples/org/apache/hama/examples/MatrixAddition.java (original)
+++ incubator/hama/trunk/src/examples/org/apache/hama/examples/MatrixAddition.java Tue Feb
16 15:29:27 2010
@@ -21,7 +21,8 @@
 
 import java.io.IOException;
 
-import org.apache.hama.matrix.DenseMatrix;
+import org.apache.hama.HamaAdmin;
+import org.apache.hama.HamaAdminImpl;
 import org.apache.hama.matrix.Matrix;
 
 public class MatrixAddition extends AbstractExample {
@@ -37,18 +38,26 @@
     String matrixA = ARGS.get(0);
     String matrixB = ARGS.get(1);
 
-    DenseMatrix a = new DenseMatrix(conf, matrixA, false);
-    DenseMatrix b = new DenseMatrix(conf, matrixB, false);
+    HamaAdmin admin = new HamaAdminImpl(conf);
+    Matrix a = admin.getMatrix(matrixA);
+    Matrix b = admin.getMatrix(matrixB);
 
     Matrix c;
-    if (ARGS.size() > 2) {
-      System.out.println("C = "+ Double.parseDouble(ARGS.get(2)) +" * B + A");
-      c = a.add(Double.parseDouble(ARGS.get(2)), b);
+    if (a.getType().equals("SparseMatrix")) {
+      System.out
+          .println("The addition of sparse matrices is not implemented yet.");
     } else {
-      System.out.println("C = A + B");
-      c = a.add(b);
+      if (ARGS.size() > 2) {
+        System.out.println("C = " + Double.parseDouble(ARGS.get(2))
+            + " * B + A");
+        c = a.add(Double.parseDouble(ARGS.get(2)), b);
+      } else {
+        System.out.println("C = A + B");
+        c = a.add(b);
+      }
+
+      c.close();
     }
-    
-    c.close();
+
   }
 }



Mime
View raw message