incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hama Wiki] Trivial Update of "InterfaceConsiderations" by udanax
Date Mon, 02 Mar 2009 01:43:40 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hama Wiki" for change notification.

The following page has been changed by udanax:
http://wiki.apache.org/hama/InterfaceConsiderations

------------------------------------------------------------------------------
  /**
   * Basic vector interface.
   */
- public interface VectorInterface {
+ public interface Vector {
-   
+ 
    /**
+    * Size of the vector
+    * 
     * @return size of the vector
     */
    public int size();
  
    /**
+    * Gets the value of index
+    * 
     * @param index
     * @return v(index)
     */
-   public double get(int index); 
+   public double get(int index);
-   
+ 
    /**
-    * v(index) = value
+    * Sets the value of index
-    *  
+    * 
     * @param index
     * @param value
     */
    public void set(int index, double value);
-   
+ 
    /**
+    * Sets the vector
+    * 
     * @param v
-    * @return x = v 
+    * @return x = v
     */
    public Vector set(Vector v);
  
    /**
-    * v(index) += value
+    * Adds the value to v(index)
-    *  
+    * 
     * @param index
     * @param value
     */
    public void add(int index, double value);
-   
+ 
    /**
+    * x = alpha*v + x
+    * 
     * @param alpha
     * @param v
-    * @return  x = alpha*v + x
+    * @return x = alpha*v + x
     */
    public Vector add(double alpha, Vector v);
  
    /**
+    * x = v + x
+    * 
     * @param v
     * @return x = v + x
     */
    public Vector add(Vector v);
-   
+ 
    /**
+    * x dot v
+    * 
     * @param v
     * @return x dot v
     */
    public double dot(Vector v);
  
+   /**
+    * v = alpha*v 
+    * 
+    * @param alpha
+    * @return v = alpha*v
+    */
+   public Vector scale(double alpha);
+   
+   /**
+    * Returns a sub-vector.
+    * 
+    * @param i0 the index of the first element
+    * @param i1 the index of the last element
+    * @return v[i0:i1]
+    */
+   public Vector subVector( int i0, int i1 ); 
+   
    /**
     * Computes the given norm of the vector
     * 
@@ -88, +117 @@

      /** Largest entry in absolute value */
      Infinity
    }
- }
+ 
+   /**
+    * Returns an iterator
+    * 
+    * @return iterator
+    */
+   public Iterator<Writable> iterator();
  }}}
  
  == Matrix ==
@@ -97, +132 @@

  /**
   * Basic matrix interface.
   */
- public interface MatrixInterface {
+ public interface Matrix {
  
    /**
+    * Gets the double value of (i, j)
+    * 
     * @param i ith row of the matrix
     * @param j jth column of the matrix
-    * @return A(i, j)
+    * @return the value of entry
+    * @throws IOException
+    */
+   public double get(int i, int j) throws IOException;
+ 
+   /**
+    * Gets the vector of row
-    */
+    * 
-   public double get(int i, int j);
+    * @param i the row index of the matrix
+    * @return the vector of row
+    * @throws IOException
+    */
+   public Vector getRow(int i) throws IOException;
  
    /**
-    * Get a number of row of the matrix
+    * Gets the vector of column
+    * 
+    * @param j the column index of the matrix
+    * @return the vector of column
+    * @throws IOException
+    */
+   public Vector getColumn(int j) throws IOException;
+ 
+   /**
+    * Get the number of row of the matrix from the meta-data column
     * 
     * @return a number of rows of the matrix
+    * @throws IOException
     */
-   public int getRows();
+   public int getRows() throws IOException;
  
    /**
-    * Get a number of column of the matrix
+    * Get the number of column of the matrix from the meta-data column
     * 
     * @return a number of columns of the matrix
+    * @throws IOException
+    */
+   public int getColumns() throws IOException;
+ 
+   /**
+    * Gets the label of the row
-    */
+    * 
-   public int getColumns();
+    * @throws IOException
+    */
+   public String getRowLabel(int i) throws IOException;
  
    /**
-    * A(i, j) = value
+    * Gets the label of the column
+    * 
+    * @throws IOException
+    */
+   public String getColumnLabel(int j) throws IOException;
+ 
+   /**
+    * Return the matrix path. 
+    * (in hbase, path is the tablename. in filesystem, path may be a file path.)
+    * 
+    * @return the name of the matrix
+    */
+   public String getPath();
+ 
+   /**
+    * Sets the label of the row
+    * 
+    * @param i
+    * @param name
+    * @throws IOException
+    */
+   public void setRowLabel(int i, String name) throws IOException;
+ 
+   /**
+    * Sets the label of the column
+    * 
+    * @param j
+    * @param name
+    * @throws IOException
+    */
+   public void setColumnLabel(int j, String name) throws IOException;
+ 
+   /**
+    * Sets the double value of (i, j)
     * 
     * @param i ith row of the matrix
     * @param j jth column of the matrix
     * @param value the value of entry
+    * @throws IOException
     */
-   public void set(int i, int j, double value);
+   public void set(int i, int j, double value) throws IOException;
  
    /**
     * A=alpha*B
@@ -135, +234 @@

     * @param alpha
     * @param B
     * @return A
+    * @throws IOException
     */
-   public Matrix set(double alpha, Matrix B);
+   public Matrix set(double alpha, Matrix B) throws IOException;
  
    /**
     * A=B
     * 
     * @param B
     * @return A
+    * @throws IOException
+    */
+   public Matrix set(Matrix B) throws IOException;
+ 
+   /**
+    * Set the row of a matrix to a given vector
-    */
+    * 
-   public Matrix set(Matrix B);
+    * @param row
+    * @param vector
+    * @throws IOException
+    */
+   public void setRow(int row, Vector vector) throws IOException;
+ 
+   /**
+    * Set the column of a matrix to a given vector
+    * 
+    * @param column
+    * @param vector
+    * @throws IOException
+    */
+   public void setColumn(int column, Vector vector) throws IOException;
  
    /**
     * Sets the dimension of matrix
     * 
-    * @param the number of rows
+    * @param rows the number of rows
-    * @param the number of columns
+    * @param columns the number of columns
+    * @throws IOException
     */
-   public void setDimension(int i, int j);
+   public void setDimension(int rows, int columns) throws IOException;
  
    /**
     * A(i, j) += value
@@ -160, +280 @@

     * @param i
     * @param j
     * @param value
+    * @throws IOException
     */
-   public void add(int i, int j, double value);
+   public void add(int i, int j, double value) throws IOException;
  
    /**
     * A = B + A
     * 
     * @param B
-    * @return
+    * @return A
+    * @throws IOException
     */
-   public Matrix add(Matrix B);
+   public Matrix add(Matrix B) throws IOException;
  
    /**
     * A = alpha*B + A
@@ -177, +299 @@

     * @param alpha
     * @param B
     * @return A
+    * @throws IOException
     */
-   public Matrix add(double alpha, Matrix B);
+   public Matrix add(double alpha, Matrix B) throws IOException;
  
    /**
     * C = A*B
     * 
     * @param B
     * @return C
+    * @throws IOException
     */
-   public Matrix mult(Matrix B);
+   public Matrix mult(Matrix B) throws IOException;
  
    /**
     * C = alpha*A*B + C
@@ -195, +319 @@

     * @param B
     * @param C
     * @return C
+    * @throws IOException
     */
-   public Matrix multAdd(double alpha, Matrix B, Matrix C)
+   public Matrix multAdd(double alpha, Matrix B, Matrix C) throws IOException;
-           
+ 
    /**
     * Computes the given norm of the matrix
     * 
     * @param type
     * @return norm of the matrix
+    * @throws IOException
+    */
+   public double norm(Norm type) throws IOException;
+ 
+   /**
+    * Supported matrix-norms.
+    */
+   enum Norm {
+     /** Largest entry in absolute value */
+     Infinity
+   }
+ 
+   /**
+    * Save to a table or file
-    */
+    * 
-   public double norm(Matrix.Norm type);
- }
+    * @param path
+    * @return true if saved
+    * @throws IOException
+    */
+   public boolean save(String path) throws IOException;
+ 
+   /**
+    * Returns the matrix type
+    * 
+    * @return the matrix type
+    */
+   public String getType();
+ 
+   /**
+    * Returns the sub matrix formed by selecting certain rows and
+    * columns from a bigger matrix. The sub matrix is a in-memory operation only.
+    * 
+    * @param i0 the start index of row
+    * @param i1 the end index of row
+    * @param j0 the start index of column
+    * @param j1 the end index of column
+    * @return the sub matrix of matrix
+    * @throws IOException
+    */
+   public SubMatrix subMatrix(int i0, int i1, int j0, int j1) throws IOException;
+ 
+   /**
+    * Close current matrix.
+    * 
+    * @throws Exception
+    */
+   public void close() throws IOException;
  }}}
  

Mime
View raw message