@CodeReview(reviewer="Justin Basilico", date="2006-07-27", changesNeeded=false, comments="Looks good.") public class SparseRowMatrix extends AbstractSparseMatrix
Modifier | Constructor and Description |
---|---|
protected |
SparseRowMatrix(no.uib.cipr.matrix.sparse.FlexCompRowMatrix internalMatrix)
Creates a SparseRowMatrix based on the appropriate MTJ matrix,
does NOT create a copy of internalMatrix.
|
protected |
SparseRowMatrix(int numRows,
int numColumns)
Creates a new empty instance of SparseRowMatrix.
|
protected |
SparseRowMatrix(Matrix matrix)
Copy constructor for general matrices, copies over nonzero values.
|
protected |
SparseRowMatrix(SparseRowMatrix matrix)
Copy constructor for SparseRowMatrix matrices
|
Modifier and Type | Method and Description |
---|---|
void |
compact()
Compact the memory used by the matrix, getting rid of any zero elements
|
int |
getEntryCount()
Gets the number of active entries in the matrix.
|
no.uib.cipr.matrix.sparse.FlexCompRowMatrix |
getInternalMatrix()
Gets the internal MTJ matrix that this class is wrapping.
|
MatrixFactory<?> |
getMatrixFactory()
Gets a matrix factory, typically one associated with this type of matrix.
|
SparseVector |
getRow(int rowIndex)
Gets the specified row of the matrix, using MTJ's internal routine
to speed things up.
|
SparseRowMatrix |
getSubMatrix(int minRow,
int maxRow,
int minColumn,
int maxColumn)
Gets the embedded submatrix inside of the Matrix, specified by the
inclusive, zero-based indices such that the result matrix will have size
(maxRow-minRow+1) x (maxColum-minCcolumn+1)
|
void |
setRow(int rowIndex,
SparseVector rowVector)
Sets the specified row of the matrix using rowVector, using MTJ's
internal routine to speed things up.
|
SparseRowMatrix |
times(AbstractMTJMatrix matrix)
Matrix multiplication of
this and matrix ,
operates like the "* " operator in Matlab |
SparseColumnMatrix |
transpose()
Returns the transpose of
this |
getColumn, isSparse, pseudoInverse, setElement, solve, times, toString, toString
clone, convertFromVector, convertToVector, dotTimesEquals, dotTimesEquals, equals, get, getElement, getNumColumns, getNumRows, getSubMatrixInto, identity, increment, inverse, isSquare, isSymmetric, iterator, logDeterminant, minusEquals, minusEquals, normFrobenius, normFrobeniusSquared, plusEquals, plusEquals, rank, scaledMinusEquals, scaledPlusEquals, scaledPlusEquals, scaleEquals, set, setInternalMatrix, solve, solve, solve, times, times, timesInto, timesInto, transposeInto, zero
assertMultiplicationDimensions, assertSameDimensions, checkMultiplicationDimensions, checkSameDimensions, decrement, decrement, dotDivide, dotDivideEquals, equals, equals, getColumnInto, getRowInto, hashCode, increment, isSymmetric, isZero, pseudoInverse, rank, setColumn, setRow, setSubMatrix, sumOfColumns, sumOfRows, toArray, trace, valuesAsList
dotTimes, isZero, minus, negative, negativeEquals, plus, scale, scaledMinus, scaledMinusEquals, scaledPlus
finalize, getClass, notify, notifyAll, wait, wait, wait
dotTimes, isZero, minus, negative, negativeEquals, plus, scale, scaledMinus, scaledMinusEquals, scaledPlus
protected SparseRowMatrix(int numRows, int numColumns)
numRows
- Number of rows in the matrix.numColumns
- Number of columns in the matrix.protected SparseRowMatrix(SparseRowMatrix matrix)
matrix
- Matrix from which to copy the internal MTJ matrix.protected SparseRowMatrix(Matrix matrix)
matrix
- Matrix from which to copy the nonzero elements into this.protected SparseRowMatrix(no.uib.cipr.matrix.sparse.FlexCompRowMatrix internalMatrix)
internalMatrix
- New internal matrix for this, no copy made.public no.uib.cipr.matrix.sparse.FlexCompRowMatrix getInternalMatrix()
AbstractMTJMatrix
getInternalMatrix
in class AbstractMTJMatrix
public SparseColumnMatrix transpose()
Matrix
this
this.getElement(i, j) == this.transpose().getElement(j, i)
for any valid i, j
.public SparseRowMatrix times(AbstractMTJMatrix matrix)
AbstractMTJMatrix
this
and matrix
,
operates like the "*
" operator in Matlabtimes
in class AbstractMTJMatrix
matrix
- this.getNumColumns()==matrix.getNumRows()
this
and
matrix
, will this.getNumRows()
rows and
matrix.getNumColumns()
columnspublic SparseRowMatrix getSubMatrix(int minRow, int maxRow, int minColumn, int maxColumn)
Matrix
minRow
- Zero-based index into the rows of the Matrix, must be less
than or equal to maxRowmaxRow
- Zero-based index into the rows of the Matrix, must be
greater than or equal to minRowminColumn
- Zero-based index into the rows of the Matrix, must be
less than or equal to maxColumnmaxColumn
- Zero-based index into the rows of the Matrix, must be
greater than or equal to minColumnpublic SparseVector getRow(int rowIndex)
getRow
in interface Matrix
getRow
in class AbstractSparseMatrix
rowIndex
- Zero-based row index.public void setRow(int rowIndex, SparseVector rowVector)
rowIndex
- Zero-based row index.rowVector
- SparseVector containing the elements to replace in
this.public void compact()
AbstractSparseMatrix
compact
in class AbstractSparseMatrix
public int getEntryCount()
Matrix
public MatrixFactory<?> getMatrixFactory()
Matrix