public abstract class AbstractSparseMatrix extends AbstractMatrix implements SparseMatrix, Serializable
Abstract Sparse matrix implements the interface of sparse matrix which can be called by any data type's sparse matrix such as double and integer
Copyright: Copyright (c) 2005
Company: IST, Drexel University
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
isFinalized |
protected boolean |
mergeMode |
protected boolean |
miniMode |
cellDataLength, columnBase, columns, rowBase, rows, transposeMatrix| Constructor and Description |
|---|
AbstractSparseMatrix(boolean mergeMode,
boolean miniMode,
int cellDataLength) |
| Modifier and Type | Method and Description |
|---|---|
double |
cosine(int rowA,
int rowB)
This method treats each row a vector and return the cosine similarity of two rows.
|
boolean |
finalizeData()
It is equal to calling finalizeData(true)
|
boolean |
genCooccurrenceMatrix(IntSparseMatrix outputCooccurMatrix)
The cell (i,j) in the output cooccurrence matrix stores the cooccurrence count of the i-th row and the j-th row.
|
boolean |
genCooccurrenceMatrix(SparseMatrix matrixY,
int minOccurrence,
IntSparseMatrix outputCooccurMatrix)
The cell (i,j) in the output cooccurrence matrix stores the cooccurrence count of the i-th row in the current matrix and the j-th row
in the matrixY.
|
boolean |
genCooccurrenceMatrix(SparseMatrix matrixY,
IntSparseMatrix outputCooccurMatrix)
The cell (i,j) in the output cooccurrence matrix stores the cooccurrence count of the i-th row in the current matrix and the j-th row
in the matrixY.
|
static boolean |
genTranslationMatrix(IntSparseMatrix inputCooccurMatrix,
DoubleSparseMatrix outputTransMatrix) |
int |
getCooccurrenceCount(int rowA,
int rowB)
If two cells in the same column have non-zero scores, they will be counted as co-occurred.
|
double |
getDouble(int row,
int column)
Return the score stored in the specified cell.
|
int |
getInt(int row,
int column)
Return the score stored in the specified cell.
|
Cell |
getNonZeroCellInColumn(int column,
int index)
This method returns the index-th non-zero cell in the given row.
|
double |
getNonZeroDoubleScoreInColumn(int column,
int index)
This method returns the double score of the index-th non-zero cell in the given column.
|
double |
getNonZeroDoubleScoreInRow(int row,
int index)
This method returns the double score of the index-th non-zero cell in the given row.
|
double[] |
getNonZeroDoubleScoresInColumn(int column)
If the given column has n non-zero cells, this method returns a n-length double array.
|
double[] |
getNonZeroDoubleScoresInRow(int row)
If the given row has n non-zero cells, this method returns a n-length double array.
|
int |
getNonZeroIntScoreInColumn(int column,
int index)
This method returns the integer score of the index-th non-zero cell in the given column.
|
int |
getNonZeroIntScoreInRow(int row,
int index)
This method returns the integer score of the index-th non-zero cell in the given row.
|
int[] |
getNonZeroIntScoresInColumn(int column)
If the given column has n non-zero cells, this method returns a n-length integer array.
|
int[] |
getNonZeroIntScoresInRow(int row)
If the given row has n non-zero cells, this method returns a n-length integer array.
|
int |
getNonZeroNumInColumn(int column)
If the transposed matrix is not set yet, this method will automatically generate the transposed matrix.
|
int |
getNonZeroRowInColumn(int column,
int index)
This method returns the row index of the index-th non-zero cell in the given column.
|
int[] |
getNonZeroRowsInColumn(int column)
If the given column has n non-zero cells, this method returns a n-length integer array.
|
boolean |
isFinalized()
If this method returns true, one can not add data to the sparse matrix any more.
|
Matrix |
transpose()
if one has set the transposed matrix by calling the method setTranspose, this method simply return that transposed matrix.
|
columns, getBaseColumn, getBaseRow, getCellDataLength, getTranspose, rows, setTransposeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, createCell, createCell, createSparseMatrix, finalizeData, flush, getCell, getNonZeroCellInRow, getNonZeroColumnInRow, getNonZeroColumnsInRow, getNonZeroNum, getNonZeroNumInRowclose, columns, getBaseColumn, getBaseRow, getCellDataLength, getTranspose, rows, setTransposeprotected boolean isFinalized
protected boolean mergeMode
protected boolean miniMode
public AbstractSparseMatrix(boolean mergeMode,
boolean miniMode,
int cellDataLength)
public boolean isFinalized()
SparseMatrixisFinalized in interface SparseMatrixpublic boolean finalizeData()
SparseMatrixfinalizeData in interface SparseMatrixpublic Cell getNonZeroCellInColumn(int column, int index)
SparseMatrixgetNonZeroCellInColumn in interface SparseMatrixcolumn - the index of the columnindex - the index-th non-zero cellpublic int getNonZeroNumInColumn(int column)
SparseMatrixgetNonZeroNumInColumn in interface SparseMatrixcolumn - the index of the columnpublic int getNonZeroRowInColumn(int column,
int index)
SparseMatrixgetNonZeroRowInColumn in interface SparseMatrixcolumn - the index of the columnindex - the index-th non-zero cellpublic int[] getNonZeroRowsInColumn(int column)
SparseMatrixgetNonZeroRowsInColumn in interface SparseMatrixcolumn - the index of the columnpublic double getDouble(int row,
int column)
Matrixpublic int getInt(int row,
int column)
Matrixpublic double getNonZeroDoubleScoreInColumn(int column,
int index)
SparseMatrixgetNonZeroDoubleScoreInColumn in interface SparseMatrixcolumn - the index of the columnindex - the index-th non-zero cellpublic double[] getNonZeroDoubleScoresInColumn(int column)
SparseMatrixgetNonZeroDoubleScoresInColumn in interface SparseMatrixcolumn - the index of the columnpublic int getNonZeroIntScoreInColumn(int column,
int index)
SparseMatrixgetNonZeroIntScoreInColumn in interface SparseMatrixcolumn - the index of the columnindex - the index-th non-zero cellpublic int[] getNonZeroIntScoresInColumn(int column)
SparseMatrixgetNonZeroIntScoresInColumn in interface SparseMatrixcolumn - the index of the columnpublic double getNonZeroDoubleScoreInRow(int row,
int index)
SparseMatrixgetNonZeroDoubleScoreInRow in interface SparseMatrixrow - the index of the row.index - the index-th non-zero cellpublic int getNonZeroIntScoreInRow(int row,
int index)
SparseMatrixgetNonZeroIntScoreInRow in interface SparseMatrixrow - the index of the row.index - the index-th non-zero cellpublic double[] getNonZeroDoubleScoresInRow(int row)
SparseMatrixgetNonZeroDoubleScoresInRow in interface SparseMatrixrow - the index of rowpublic int[] getNonZeroIntScoresInRow(int row)
SparseMatrixgetNonZeroIntScoresInRow in interface SparseMatrixrow - the index of rowpublic boolean genCooccurrenceMatrix(IntSparseMatrix outputCooccurMatrix)
SparseMatrixgenCooccurrenceMatrix in interface SparseMatrixoutputCooccurMatrix - the output cooccurrence matrixpublic boolean genCooccurrenceMatrix(SparseMatrix matrixY, IntSparseMatrix outputCooccurMatrix)
SparseMatrixgenCooccurrenceMatrix in interface SparseMatrixmatrixY - another sparse matrixoutputCooccurMatrix - the output cooccurrence matrixpublic boolean genCooccurrenceMatrix(SparseMatrix matrixY, int minOccurrence, IntSparseMatrix outputCooccurMatrix)
SparseMatrixgenCooccurrenceMatrix in interface SparseMatrixmatrixY - another sparse matrixminOccurrence - the minimum cooccurrence countoutputCooccurMatrix - the output cooccurrence matrixpublic int getCooccurrenceCount(int rowA,
int rowB)
MatrixgetCooccurrenceCount in interface MatrixrowA - the index of the first rowrowB - the index of the second rowpublic double cosine(int rowA,
int rowB)
Matrixpublic static boolean genTranslationMatrix(IntSparseMatrix inputCooccurMatrix, DoubleSparseMatrix outputTransMatrix)
public Matrix transpose()
Matrixtranspose in interface Matrixtranspose in class AbstractMatrixCopyright © 2018 JULIE Lab, Germany. All rights reserved.