You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hama.apache.org by ed...@apache.org on 2008/10/28 07:03:30 UTC

svn commit: r708450 - /incubator/hama/trunk/src/java/org/apache/hama/SubMatrix.java

Author: edwardyoon
Date: Mon Oct 27 23:03:30 2008
New Revision: 708450

URL: http://svn.apache.org/viewvc?rev=708450&view=rev
Log:
Add some comments.

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

Modified: incubator/hama/trunk/src/java/org/apache/hama/SubMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/SubMatrix.java?rev=708450&r1=708449&r2=708450&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/SubMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/SubMatrix.java Mon Oct 27 23:03:30 2008
@@ -21,27 +21,62 @@
 
 import org.apache.log4j.Logger;
 
+/**
+ * A sub matrix is a matrix formed by selecting certain rows and columns from a
+ * bigger matrix. This is a in-memory operation only.
+ */
 public class SubMatrix {
   static final Logger LOG = Logger.getLogger(SubMatrix.class);
   private double[][] matrix;
-  
+
+  /**
+   * Constructor
+   * 
+   * @param i the size of rows
+   * @param j the size of columns
+   */
   public SubMatrix(int i, int j) {
     matrix = new double[i][j];
   }
 
+  /**
+   * Constructor
+   * 
+   * @param c a two dimensional double array
+   */
   public SubMatrix(double[][] c) {
     double[][] matrix = c;
     this.matrix = matrix;
   }
 
+  /**
+   * Sets the value
+   * 
+   * @param row
+   * @param column
+   * @param value
+   */
   public void set(int row, int column, double value) {
     matrix[row][column] = value;
   }
 
+  /**
+   * Gets the value
+   * 
+   * @param i
+   * @param j
+   * @return
+   */
   public double get(int i, int j) {
     return matrix[i][j];
   }
 
+  /**
+   * c = a*b
+   * 
+   * @param b
+   * @return c
+   */
   public SubMatrix mult(SubMatrix b) {
     double[][] C = new double[size()][size()];
     for (int i = 0; i < size(); i++) {
@@ -54,7 +89,7 @@
 
     return new SubMatrix(C);
   }
-  
+
   public int size() {
     return matrix.length;
   }