public abstract class AbstractFlatSparseMatrix extends AbstractSparseMatrix implements Serializable
Abstract flat sparse matrix handles sparse matrix smaller than super sparse matrix while adding options for read and store matrix data to disk either in text or binary format
Copyright: Copyright (c) 2005
Company: IST, Drexel University
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList |
list |
isFinalized, mergeMode, miniModecellDataLength, columnBase, columns, rowBase, rows, transposeMatrix| Constructor and Description |
|---|
AbstractFlatSparseMatrix(boolean mergeMode,
boolean miniMode,
int cellDataLength) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(Cell cell)
Add a cell to the sparse matrix.
|
void |
close()
Close the matrix and release all resources.
|
boolean |
finalizeData(boolean sorting)
Any sparse matrix has two possible modes, writing mode and reading mode.
|
void |
flush()
Many implementations of sparse matrix cache cells in memory.
|
Cell |
getCell(int row,
int column)
If the specified cell doesn't exist, this method will return null.
|
Cell |
getNonZeroCell(int index) |
Cell |
getNonZeroCellInRow(int row,
int index)
This method returns the index-th non-zero cell in the given column.
|
int |
getNonZeroColumnInRow(int row,
int index)
This method returns the column index of the index-th non-zero cell in the given row.
|
int[] |
getNonZeroColumnsInRow(int row)
If the given row has n non-zero cells, this method returns a n-length integer array.
|
int |
getNonZeroNum() |
int |
getNonZeroNumInRow(int row) |
protected int |
getRowEnd(int row) |
protected int |
getRowStart(int row) |
void |
print(PrintWriter out) |
protected boolean |
readBinaryMatrixFile(String filename) |
protected boolean |
readTextMatrixFile(String filename) |
void |
saveTo(String filename) |
void |
saveTo(String filename,
boolean binary) |
void |
setDouble(int row,
int column,
double score) |
void |
setInt(int row,
int column,
int score) |
void |
setNonZeroDoubleScoreInRow(int row,
int index,
double score) |
void |
setNonZeroIntScoreInRow(int row,
int index,
int score) |
cosine, finalizeData, genCooccurrenceMatrix, genCooccurrenceMatrix, genCooccurrenceMatrix, genTranslationMatrix, getCooccurrenceCount, getDouble, getInt, getNonZeroCellInColumn, getNonZeroDoubleScoreInColumn, getNonZeroDoubleScoreInRow, getNonZeroDoubleScoresInColumn, getNonZeroDoubleScoresInRow, getNonZeroIntScoreInColumn, getNonZeroIntScoreInRow, getNonZeroIntScoresInColumn, getNonZeroIntScoresInRow, getNonZeroNumInColumn, getNonZeroRowInColumn, getNonZeroRowsInColumn, isFinalized, transposecolumns, getBaseColumn, getBaseRow, getCellDataLength, getTranspose, rows, setTransposeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateCell, createCell, createSparseMatrixcolumns, getBaseColumn, getBaseRow, getCellDataLength, getTranspose, rows, setTransposeprotected ArrayList list
public AbstractFlatSparseMatrix(boolean mergeMode,
boolean miniMode,
int cellDataLength)
protected int getRowStart(int row)
protected int getRowEnd(int row)
public void close()
Matrixpublic int getNonZeroNum()
getNonZeroNum in interface SparseMatrixpublic Cell getNonZeroCell(int index)
public Cell getCell(int row, int column)
SparseMatrixgetCell in interface SparseMatrixrow - the index of row in the matrixcolumn - the index of column in the matrixpublic Cell getNonZeroCellInRow(int row, int index)
SparseMatrixgetNonZeroCellInRow in interface SparseMatrixrow - the index of the rowindex - the index-th non-zero cellpublic int getNonZeroNumInRow(int row)
getNonZeroNumInRow in interface SparseMatrixrow - the index of the rowpublic boolean add(Cell cell)
SparseMatrixadd in interface SparseMatrixcell - the input cellpublic int getNonZeroColumnInRow(int row,
int index)
SparseMatrixgetNonZeroColumnInRow in interface SparseMatrixrow - the index of the rowindex - the index-th non-zero cellpublic int[] getNonZeroColumnsInRow(int row)
SparseMatrixgetNonZeroColumnsInRow in interface SparseMatrixrow - the index of rowpublic void setNonZeroDoubleScoreInRow(int row,
int index,
double score)
public void setNonZeroIntScoreInRow(int row,
int index,
int score)
public void setDouble(int row,
int column,
double score)
public void setInt(int row,
int column,
int score)
public void flush()
SparseMatrixflush in interface SparseMatrixpublic boolean finalizeData(boolean sorting)
SparseMatrixfinalizeData in interface SparseMatrixsorting - if need to sort the added cells before finalization.public void saveTo(String filename, boolean binary)
public void saveTo(String filename)
public void print(PrintWriter out)
protected boolean readBinaryMatrixFile(String filename)
protected boolean readTextMatrixFile(String filename)
Copyright © 2018 JULIE Lab, Germany. All rights reserved.