public abstract class AbstractGiantSparseMatrix extends AbstractSparseMatrix
The abstract sparse matrix for handling extreme large sparse matrirwhich will write matrix data to disk whenever it's over fulsh interval by default 1000,000 and superior to AbstractSuperSparseMatrix, however it's lack of some basic matrix operation functions such as getNonZeroColumnInRow privided by AbstractSuperSparseMatrix because it focuses on storing and loading matrix to disk efficiently
Copyright: Copyright (c) 2005
Company: IST, Drexel University
| Modifier and Type | Field and Description |
|---|---|
protected AbstractFlatSparseMatrix |
cacheMatrix |
protected int |
flushInterval |
protected String |
indexFilename |
protected SparseMatrixFactory |
matrixFactory |
protected String |
matrixFilename |
protected RandomAccessFile |
rafIndex |
protected RandomAccessFile |
rafMatrix |
protected int |
totalCell |
isFinalized, mergeMode, miniModecellDataLength, columnBase, columns, rowBase, rows, transposeMatrix| Constructor and Description |
|---|
AbstractGiantSparseMatrix(String indexFilename,
String matrixFilename,
int cellDataLength) |
AbstractGiantSparseMatrix(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 |
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 indexFilename
protected String matrixFilename
protected int totalCell
protected RandomAccessFile rafIndex
protected RandomAccessFile rafMatrix
protected AbstractFlatSparseMatrix cacheMatrix
protected int flushInterval
protected SparseMatrixFactory matrixFactory
public AbstractGiantSparseMatrix(String indexFilename, String matrixFilename, int cellDataLength)
protected abstract Row createRow(int row, int columns, byte[] data)
protected abstract AbstractFlatSparseMatrix createFlatSparseMatrix(boolean mergeMode, boolean miniMode)
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.