public class SparseRowMaskedMatrix extends RowMaskedMatrix implements SparseMatrix
SparseMatrix instance where selected rows of the
instance a represented as a single, contiguous matrix. This effectively
creates a SparseMatrix out of a possibly non-contiguous selection of
the rows of the original. This class is intended to be use when a large
matrix has been created and submatrices of the large matrix need to be
treated as full SparseMatrix instances; rather than copy the data,
this class provides a way of representing the original data as a partial
view.
All methods are write-through to the original backing matrix.
This matrix recomputes the mapping if the Matrix being masked is also
a RowMaskedMatrix, thus preventing a recursive call to row lookups.RowMaskedMatrixMatrix.Type| Constructor and Description |
|---|
SparseRowMaskedMatrix(SparseMatrix matrix,
BitSet included)
Creates a partial view of the provided sparse matrix using the bits set
to
true as the rows that should be included |
SparseRowMaskedMatrix(SparseMatrix matrix,
int[] reordering)
Creates a partial view of the provided sparse matrix using the the
integer mapping to specify which rows should be included in the matrix.
|
SparseRowMaskedMatrix(SparseMatrix matrix,
Set<Integer> included)
Creates a partial view of the provided sparse matrix using the integers
in the set to specify which rows should be included in the matrix.
|
| Modifier and Type | Method and Description |
|---|---|
SparseDoubleVector |
getColumnVector(int column)
Returns the column as a vector.
|
SparseDoubleVector |
getRowVector(int row)
Returns a
DoubleVector for an entire row. |
backingMatrix, columns, get, getColumn, getRealRow, getRow, reordering, rows, set, setColumn, setColumn, setRow, setRow, toDenseArraypublic SparseRowMaskedMatrix(SparseMatrix matrix, BitSet included)
true as the rows that should be includedIllegalArgumentException - if included has a bit set whose
index is greater than the number of rows present in matrixpublic SparseRowMaskedMatrix(SparseMatrix matrix, Set<Integer> included)
IllegalArgumentException - if included specifies a value
that is less than 0 or greater than the number of rows present in
matrixpublic SparseRowMaskedMatrix(SparseMatrix matrix, int[] reordering)
IllegalArgumentException - if included specifies a value
that is less than 0 or greater than the number of rows present in
matrixpublic SparseDoubleVector getColumnVector(int column)
SparseVector instance.getColumnVector in interface MatrixgetColumnVector in interface SparseMatrixgetColumnVector in class RowMaskedMatrixcolumn - The column to return a DoubleVector for.DoubleVector representing the column at column.public SparseDoubleVector getRowVector(int row)
DoubleVector for an entire row. Implementations should
return an approriately typed DoubleVector. Whether updates to the vector
are written through to the backing matrix is left open to the specific
implementation. Implementations that maintain their data in a sparse
format are encouraged to return a SparseVector instance.getRowVector in interface MatrixgetRowVector in interface SparseMatrixgetRowVector in class RowMaskedMatrixrow - the index of the row to return.DoubleVector representing the row at row.Copyright © 2012. All Rights Reserved.