/**
* Basic matrix interface.
*/
public interface MatrixInterfaceMatrix {
/**
* 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) the value of entry
* @throws IOException
*/
public double get(int i, int j) throws IOException;
/**
* Gets the vector of row
*
* @param i the row index of the matrix
* @return the vector of row
* @throws IOException
*/
public doubleVector getgetRow(int i, ) throws IOException;
/**
* 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 athe number of row of the matrix from the meta-data column
*
* @return a number of rows of the matrix
* @throws IOException
*/
public int getRows() throws IOException;
/**
* Get athe 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
*
* @throws IOException
*/
public String getRowLabel(int i) throws IOException;
/**
* 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
* A(i, j) = value/
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) throws IOException;
/**
* A=alpha*B
*
* @param alpha
* @param B
* @return A
* @throws IOException
*/
public Matrix set(double alpha, Matrix B) throws IOException;
/**
* A=B
*
* @param B
* @return A
* @throws IOException
*/
public Matrix set(Matrix B) throws IOException;
/**
* A(row,column) Set the row of a matrix to a given vector
*
* @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 rows the number of rows
* @param columns the number of columns
* @throws IOException
*/
public void setDimension(int rows, int columns) throws IOException;
/**
* A(i, j) += value
*
* @param rowi
* @param columnj
* @param value
* @throws IOException
*/
public void add(int rowi, int columnj, double value) throws IOException;
/**
* A = B + A
*
* @param B
* @return A
* @throws IOException
*/
public Matrix add(Matrix B) throws IOException;
/**
* A = alpha*B + A
*
* @param alpha
* @param B
* @return A
* @throws IOException
*/
public Matrix add(double alpha, Matrix B) throws IOException;
/**
* C = A*B
*
* @param B
* @return C
* @throws IOException
*/
public Matrix mult(Matrix B) throws IOException;
/**
* C = alpha*A*B + C
*
* @param alpha
* @param B
* @param C
* @return C
* @throws IOException
*/
public Matrix multAdd(double alpha, Matrix B, Matrix C) throws IOException;
/**
* Computes the given norm of the matrix
/ *
* @param type
* Computes the given norm of the matrix@return norm of the matrix
* @throws IOException
*/
public double norm(Norm type) throws IOException;
/**
* Supported matrix-norms.
*/
enum Norm {
/** Maximum absolute row sum */
One,
/** The root of sum of the sum of squares */
Frobenius,
/** Largest entry in absolute value */
Infinity,
/** Largest entry in absolute value. */
Maxvalue
}
/**
* Save to a table or file
*
* @param path
* @return true if saved
* @throws IOException
*/
public boolean save(String path) throws IOException;
/**
* Returns the matrix type
*
* @return norm of the 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 doubleSubMatrix norm(Matrix.Norm type)subMatrix(int i0, int i1, int j0, int j1) throws IOException;
/**
* Close current matrix.
*
* @throws Exception
*/
public void close() throws IOException;
}
|