public abstract class AbstractSuperSparseMatrix extends AbstractSparseMatrix
Abstract super sparse matrix is designed for large sparse matrix which first caches data and then processes data and write data to disk when it's over flush interval
Copyright: Copyright (c) 2005
Company: IST, Drexel University
| Modifier and Type | Field and Description |
|---|---|
protected Row[] |
arrCachedRow |
protected float[] |
arrRowLoadFactor |
protected int[] |
arrRowPosInCache |
protected long[] |
arrRowPosInFile |
protected int[] |
arrRowStart |
protected AbstractFlatSparseMatrix |
cacheMatrix |
protected int |
cacheSize |
protected int |
firstEmpty |
protected int |
flushInterval |
protected String |
indexFilename |
protected RandomAccessFile |
matrix |
protected SparseMatrixFactory |
matrixFactory |
protected String |
matrixFilename |
protected int |
totalCell |
isFinalized, mergeMode, miniModecellDataLength, columnBase, columns, rowBase, rows, transposeMatrix| Constructor and Description |
|---|
AbstractSuperSparseMatrix(String indexFilename,
String matrixFilename,
int cellDataLength) |
AbstractSuperSparseMatrix(String indexFilename,
String matrixFilename,
int cellDataLength,
boolean mergeMode,
boolean miniMode) |
| 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.
|
protected abstract AbstractFlatSparseMatrix |
createFlatSparseMatrix(boolean mergeMode,
boolean miniMode) |
protected abstract Row |
createRow(int row,
int columns,
byte[] data) |
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 col)
If the specified cell doesn't exist, this method will return null.
|
String |
getIndexFilename() |
String |
getMatrixFilename() |
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 Row |
getRow(int index) |
void |
setCache(int cacheSize) |
void |
setFlushInterval(int interval) |
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 String matrixFilename
protected String indexFilename
protected int totalCell
protected RandomAccessFile matrix
protected long[] arrRowPosInFile
protected int cacheSize
protected Row[] arrCachedRow
protected float[] arrRowLoadFactor
protected int[] arrRowPosInCache
protected int[] arrRowStart
protected int firstEmpty
protected AbstractFlatSparseMatrix cacheMatrix
protected int flushInterval
protected SparseMatrixFactory matrixFactory
public AbstractSuperSparseMatrix(String indexFilename, String matrixFilename, int cellDataLength, boolean mergeMode, boolean miniMode)
protected abstract Row createRow(int row, int columns, byte[] data)
protected abstract AbstractFlatSparseMatrix createFlatSparseMatrix(boolean mergeMode, boolean miniMode)
public void setCache(int cacheSize)
public void setFlushInterval(int interval)
public void close()
Matrixpublic boolean add(Cell cell)
SparseMatrixcell - the input cellpublic void flush()
SparseMatrixpublic boolean finalizeData(boolean sorting)
SparseMatrixsorting - if need to sort the added cells before finalization.public String getMatrixFilename()
public String getIndexFilename()
public int getNonZeroNum()
public int getNonZeroNumInRow(int row)
row - the index of the rowpublic int getNonZeroColumnInRow(int row,
int index)
SparseMatrixrow - the index of the rowindex - the index-th non-zero cellpublic int[] getNonZeroColumnsInRow(int row)
SparseMatrixrow - the index of rowpublic Cell getCell(int row, int col)
SparseMatrixrow - the index of row in the matrixcol - the index of column in the matrixpublic Cell getNonZeroCellInRow(int row, int index)
SparseMatrixrow - the index of the rowindex - the index-th non-zero cellprotected Row getRow(int index)
Copyright © 2018 JULIE Lab, Germany. All rights reserved.