|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--dragon.matrix.AbstractMatrix
|
+--dragon.matrix.AbstractSparseMatrix
|
+--dragon.matrix.AbstractSuperSparseMatrix
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
| Field Summary | |
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 java.lang.String |
indexFilename
|
protected java.io.RandomAccessFile |
matrix
|
protected SparseMatrixFactory |
matrixFactory
|
protected java.lang.String |
matrixFilename
|
protected int |
totalCell
|
| Fields inherited from class dragon.matrix.AbstractSparseMatrix |
isFinalized, mergeMode, miniMode |
| Fields inherited from class dragon.matrix.AbstractMatrix |
cellDataLength, columnBase, columns, rowBase, rows, transposeMatrix |
| Constructor Summary | |
AbstractSuperSparseMatrix(java.lang.String indexFilename,
java.lang.String matrixFilename,
int cellDataLength)
|
|
AbstractSuperSparseMatrix(java.lang.String indexFilename,
java.lang.String matrixFilename,
int cellDataLength,
boolean mergeMode,
boolean miniMode)
|
|
| Method Summary | |
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. |
java.lang.String |
getIndexFilename()
|
java.lang.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)
|
| Methods inherited from class dragon.matrix.AbstractMatrix |
columns, getBaseColumn, getBaseRow, getCellDataLength, getTranspose, rows, setTranspose |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface dragon.matrix.SparseMatrix |
createCell, createCell, createSparseMatrix |
| Methods inherited from interface dragon.matrix.Matrix |
columns, getBaseColumn, getBaseRow, getCellDataLength, getTranspose, rows, setTranspose |
| Field Detail |
protected java.lang.String matrixFilename
protected java.lang.String indexFilename
protected int totalCell
protected java.io.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
| Constructor Detail |
public AbstractSuperSparseMatrix(java.lang.String indexFilename,
java.lang.String matrixFilename,
int cellDataLength,
boolean mergeMode,
boolean miniMode)
public AbstractSuperSparseMatrix(java.lang.String indexFilename,
java.lang.String matrixFilename,
int cellDataLength)
| Method Detail |
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()
Matrix
public boolean add(Cell cell)
SparseMatrix
cell - the input cell
public void flush()
SparseMatrix
public boolean finalizeData(boolean sorting)
SparseMatrix
sorting - if need to sort the added cells before finalization.
public java.lang.String getMatrixFilename()
public java.lang.String getIndexFilename()
public int getNonZeroNum()
public int getNonZeroNumInRow(int row)
row - the index of the row
public int getNonZeroColumnInRow(int row,
int index)
SparseMatrix
row - the index of the rowindex - the index-th non-zero cell
public int[] getNonZeroColumnsInRow(int row)
SparseMatrix
row - the index of row
public Cell getCell(int row,
int col)
SparseMatrix
row - the index of row in the matrixcol - the index of column in the matrix
public Cell getNonZeroCellInRow(int row,
int index)
SparseMatrix
row - the index of the rowindex - the index-th non-zero cell
protected Row getRow(int index)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||