public class ClutoDenseMatrixBuilder extends Object implements MatrixBuilder
MatrixBuilder
for building dense cluto matrix input files.Constructor and Description |
---|
ClutoDenseMatrixBuilder()
Creates a new
ClutoSparseMatrixBuilder using a constructed temp
file. |
ClutoDenseMatrixBuilder(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 the data format for the matrix file.
|
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 ClutoDenseMatrixBuilder()
ClutoSparseMatrixBuilder
using a constructed temp
file.public ClutoDenseMatrixBuilder(File backingFile)
ClutoSparseMatrixBuilder
using a the given
file.public int addColumn(double[] row)
addColumn
in interface MatrixBuilder
row
- 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 MatrixBuilder
row
- the values of the column in the matrix.public int addColumn(Vector row)
addColumn
in interface MatrixBuilder
row
- 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 MatrixBuilder
public 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 MatrixBuilder
public MatrixIO.Format getMatrixFormat()
getMatrixFormat
in interface MatrixBuilder
public MatrixFile getMatrixFile()
getMatrixFile
in interface MatrixBuilder
public 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 MatrixBuilder
true
if no further data should be added to the matrixCopyright © 2012. All Rights Reserved.