incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r719178 - in /incubator/hama/trunk: CHANGES.txt src/java/org/apache/hama/AbstractMatrix.java src/test/org/apache/hama/TestDenseMatrix.java
Date Thu, 20 Nov 2008 06:23:07 GMT
Author: edwardyoon
Date: Wed Nov 19 22:23:07 2008
New Revision: 719178

URL: http://svn.apache.org/viewvc?rev=719178&view=rev
Log:
Implement AbstractMatrix.add(int i, int j, double value)

Modified:
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
    incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=719178&r1=719177&r2=719178&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Wed Nov 19 22:23:07 2008
@@ -33,6 +33,7 @@
     
   IMPROVEMENTS
     
+    HAMA-108: Implement AbstractMatrix.add(int i, int j, double value)
     HAMA-103: Reduce an rows of intermediate 
                 to improve the multiplication performance (edwardyoon)
     HAMA-88: DenseMatrix.close should not delete the table 

Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java?rev=719178&r1=719177&r2=719178&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java Wed Nov 19 22:23:07
2008
@@ -125,7 +125,9 @@
 
   /** {@inheritDoc} */
   public void add(int i, int j, double value) throws IOException {
-    // TODO Auto-generated method stub
+    VectorUpdate update = new VectorUpdate(i);
+    update.put(j, value + this.get(i, j));
+    table.commit(update.getBatchUpdate());
   }
 
   /** {@inheritDoc} */

Modified: incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java?rev=719178&r1=719177&r2=719178&view=diff
==============================================================================
--- incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java (original)
+++ incubator/hama/trunk/src/test/org/apache/hama/TestDenseMatrix.java Wed Nov 19 22:23:07
2008
@@ -75,6 +75,13 @@
     m2.close();
   }
 
+  public void testEntryAdd() throws IOException {
+    double origin = m1.get(1, 1);
+    m1.add(1, 1, 0.5);
+    
+    assertEquals(m1.get(1, 1), origin + 0.5);
+  }
+  
   public void testBlocking() throws IOException, ClassNotFoundException {
     assertEquals(((DenseMatrix) m1).isBlocked(), false);
     ((DenseMatrix) m1).blocking(2);



Mime
View raw message