public class ClutoSparseMatrixBuilder extends Object implements MatrixBuilder
MatrixBuilder for building sparse cluto matrix input files.| Constructor and Description |
|---|
ClutoSparseMatrixBuilder()
Creates a new
ClutoSparseMatrixBuilder using a constructed temp
file. |
ClutoSparseMatrixBuilder(File backingFile)
Creates a new
ClutoSparseMatrixBuilder using a the given
file. |
| Modifier and Type | Method and Description |
|---|---|
int |
addColumn(double[] row)
Adds the column values to the underlying matrix, updating the dimensions
as necessary and returning the index at which the column was added.
|
int |
addColumn(SparseArray<? extends Number> row)
Adds the
double values in the array to the underlying matrix,
updating the dimensions as necessary and returning the index at which the
column was added. |
int |
addColumn(Vector row)
Adds the vector values to the underlying matrix, updating the dimensions
as necessary and returning the index at which the column was added.
|
void |
finish()
Indicates that no further data will be added to the matrix and any
remaining matrix meta-data should be written and flushed to disk.
|
File |
getFile()
Returns the file containing the matrix data after all data has finished
being written.
|
MatrixFile |
getMatrixFile() |
MatrixIO.Format |
getMatrixFormat()
Returns {@link MatrixIO#Format.CLUTO_SPARSE.
|
boolean |
isFinished()
Returns
true if no further data should be added to the matrix and
the file containing the data is available for us. |
public ClutoSparseMatrixBuilder()
ClutoSparseMatrixBuilder using a constructed temp
file.public ClutoSparseMatrixBuilder(File backingFile)
ClutoSparseMatrixBuilder using a the given
file.public int addColumn(double[] row)
addColumn in interface MatrixBuilderrow - the values of the column in the matrix.public int addColumn(SparseArray<? extends Number> row)
double values in the array to the underlying matrix,
updating the dimensions as necessary and returning the index at which the
column was added.addColumn in interface MatrixBuilderrow - the values of the column in the matrix.public int addColumn(Vector row)
addColumn in interface MatrixBuilderrow - the values of the column in the matrix.public void finish()
addColumn will thcolumn a IllegalStateException if called. Once this method has been called, any subsequent calls will
have no effect and will not throw an exception.finish in interface MatrixBuilderpublic File getFile()
finish method must be called prior to
accessing the underlying file to ensure that all necessary matrix
meta-data has been written to disk.getFile in interface MatrixBuilderpublic MatrixIO.Format getMatrixFormat()
CLUTO_SPARSE.getMatrixFormat in interface MatrixBuilderpublic MatrixFile getMatrixFile()
getMatrixFile in interface MatrixBuilderpublic boolean isFinished()
true if no further data should be added to the matrix and
the file containing the data is available for us. This will only return
true if finish has been called first.isFinished in interface MatrixBuildertrue if no further data should be added to the matrixCopyright © 2012. All Rights Reserved.