/**
* Basic matrix interface.
*/
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 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 Vector getRow(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 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() throws IOException;
/**
* Get the number of column of the matrix from the meta-data column
*
* @return a number of columns of the matrix 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 getColumns(i) throws IOException;
/**
* Gets the label of the rowcolumn
*
* @throws IOException
*/
public String getRowLabelgetColumnLabel(int ij) throws IOException;
/**
* Gets the label of the column /**
* Return the matrix path.
* (in hbase, path is the tablename. in filesystem, path may be a file path.)
*
* @throws IOException @return the name of the matrix
*/
public String getColumnLabelgetPath(int j) throws IOException;
/**
* Return the matrix path.
* (inSets hbase,the pathlabel isof the row
tablename. in filesystem,* path
may be a* file@param path.)i
* @param name
* @return the name of the matrix@throws IOException
*/
public void setRowLabel(int i, String getPath() name) throws IOException;
/**
* Sets the label of the rowcolumn
*
* @param ij
* @param name
* @throws IOException
*/
public void setRowLabelsetColumnLabel(int ij, String name) throws IOException;
/**
* Sets the double labelvalue of the column(i, j)
*
* @param i ith row of the matrix
* @param j jth column of the matrix
* @param name value the value of entry
* @throws IOException
*/
public void setColumnLabelset(int i, int j, Stringdouble namevalue) throws IOException;
/**
* Sets the double value of (i, j)
* A=alpha*B
* @param i ith row of the matrix
* @param j jth column of the matrixalpha
* @param B
value the value* of@return entryA
* @throws IOException
*/
public voidMatrix set(intdouble ialpha, int j, double valueMatrix B) throws IOException;
/**
* A=alpha*B
*
* @param alpha
* @param B
* @return A
* @throws IOException
*/
public Matrix set(double alpha, Matrix B) throws IOException;
/**
* Set /**
* A=Bthe row of a matrix to a given vector
*
* @param Brow
* @return@param Avector
* @throws IOException
*/
public Matrixvoid set(Matrix BsetRow(int row, Vector vector) throws IOException;
/**
* Set the rowcolumn of a matrix to a given vector
*
* @param rowcolumn
* @param vector
* @throws IOException
*/
public void setRowsetColumn(int rowcolumn, Vector vector) throws IOException;
/**
* SetSets the columndimension of a matrix to a given vector
* matrix
*
* @param rows the number of rows
* @param column
columns the number *of @param vectorcolumns
* @throws IOException
*/
public void setColumnsetDimension(int columnrows, Vectorint vectorcolumns) throws IOException;
/**
* Sets the dimension of matrixA(i, j) += value
*
* @param i
rows the number* of@param rowsj
* @param columns the number of columnsvalue
* @throws IOException
*/
public void setDimensionadd(int rowsi, int j, double columnsvalue) throws IOException;
/**
* A(i, j) += value
B + * A
* @param i
* @param jB
* @param@return valueA
* @throws IOException
*/
public voidMatrix add(int i, int j, double valueMatrix B) throws IOException;
/**
* A = B + A alpha*B + A
*
* @param alpha
* @param B
* @return A
* @throws IOException
*/
public Matrix add(double alpha, Matrix B) throws IOException;
/**
* AC = alphaA*B + A
*
* @param alpha
* @param B
* @return AC
* @throws IOException
*/
public Matrix addmult(double alpha, Matrix B) throws IOException;
/**
* C = alpha*A*B + C
*
* @param alpha
* @param B
* @param BC
* @return C
* @throws IOException
*/
public Matrix multmultAdd(double alpha, Matrix B, Matrix C) throws IOException;
/**
* CComputes = alpha*A*B + C
* the given norm of the matrix
* @param alpha
* @param Btype
* @param@return C
norm of the * @return Cmatrix
* @throws IOException
*/
public Matrix multAdd(double alpha, Matrixpublic B, Matrix Cdouble norm(Norm type) throws IOException;
/**
* Computes the given norm of the matrix
*
* @param type
* @return norm Supported matrix-norms.
*/
enum Norm {
/** Maximum absolute row sum */
One,
/** The root of sum of the matrix
sum of squares * @throws/
IOException
*/Frobenius,
public double norm(Norm
type) throws IOException;
/**
Largest entry in *absolute Supported matrix-norms.
value */
*/Infinity,
enum Norm {
/** Largest entry in absolute value. */
InfinityMaxvalue
}
/**
* 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 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;
}
|