public class MatlabSparseMatrixBuilder extends Object implements MatrixBuilder
MatrixBuilder implementation for creating matrix files in the
Matlab&cp; sparse matrix format.
This class is thread-safe.
| Constructor and Description |
|---|
MatlabSparseMatrixBuilder()
Creates a builder for a matrix in the
MATLAB_SPARSE format to be stored in a
temporary file. |
MatlabSparseMatrixBuilder(boolean transposeData)
Creates a builder for a matrix in the
MATLAB_SPARSE format to be stored in a
temporary file. |
MatlabSparseMatrixBuilder(File backingFile)
Creates a builder for a matrix in the
MATLAB_SPARSE format, which will be stored
in the specified file. |
MatlabSparseMatrixBuilder(File backingFile,
boolean transposeData)
Creates a builder for a matrix in the
MATLAB_SPARSE format, which will be stored
in the specified file. |
| Modifier and Type | Method and Description |
|---|---|
int |
addColumn(double[] column)
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> column)
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 col)
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
MATLAB_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 MatlabSparseMatrixBuilder()
MATLAB_SPARSE format to be stored in a
temporary file.public MatlabSparseMatrixBuilder(boolean transposeData)
MATLAB_SPARSE format to be stored in a
temporary file.transposeData - true if the input matrix columns should be
tranposed in the backing matrix filepublic MatlabSparseMatrixBuilder(File backingFile)
MATLAB_SPARSE format, which will be stored
in the specified file.backingFile - the file to which the matrix should be writtenpublic MatlabSparseMatrixBuilder(File backingFile, boolean transposeData)
MATLAB_SPARSE format, which will be stored
in the specified file.backingFile - the file to which the matrix should be writtentransposeData - true if the input matrix columns should be
tranposed in the backing matrix filepublic int addColumn(double[] column)
addColumn in interface MatrixBuildercolumn - the values of the column in the matrix.public int addColumn(SparseArray<? extends Number> column)
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 MatrixBuildercolumn - the values of the column in the matrix.public int addColumn(Vector col)
addColumn in interface MatrixBuildercol - 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()
MATLAB_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.