public class CellMaskedSparseMatrix extends CellMaskedMatrix implements SparseMatrix
SparseMatrix
decorator allows every row and column index to be
remapped to new indices. The size of this matrix will depend on the number
of mapped rows and columns. Write-through access is allowed for each cell in
the underlying matrix through the set
method. Array based accessors
and getters are disabled when using this decorator.Matrix.Type
Constructor and Description |
---|
CellMaskedSparseMatrix(SparseMatrix matrix,
int[] rowMaskMap,
int[] colMaskMap)
Creates a new
CellMaskedSparseMatrix from a given SparseMatrix and maps, one for the row indices and one for the column
indices. |
Modifier and Type | Method and Description |
---|---|
SparseDoubleVector |
getColumnVector(int col)
Returns the column as a vector.
|
SparseDoubleVector |
getRowVector(int row)
Returns a
DoubleVector for an entire row. |
columns, get, getColumn, getIndexFromMap, getRow, rows, set, setColumn, setColumn, setRow, setRow, toDenseArray
public CellMaskedSparseMatrix(SparseMatrix matrix, int[] rowMaskMap, int[] colMaskMap)
CellMaskedSparseMatrix
from a given SparseMatrix
and maps, one for the row indices and one for the column
indices. Only valid mappings should be included.matrix
- The underlying matrix to decoraterowMaskMap
- A mapping from new indices to old indices in the
original map for rows.colMaskMap
- A mapping from new indices to old indices in the
original map for columns.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 Matrix
getRowVector
in interface SparseMatrix
getRowVector
in class CellMaskedMatrix
row
- the index of the row to return.DoubleVector
representing the row at row
.public SparseDoubleVector getColumnVector(int col)
SparseVector
instance.getColumnVector
in interface Matrix
getColumnVector
in interface SparseMatrix
getColumnVector
in class CellMaskedMatrix
col
- The column to return a DoubleVector
for.DoubleVector
representing the column at column
.Copyright © 2012. All Rights Reserved.