@CodeReview(reviewer="Jonathan McClain", date="2006-05-19", changesNeeded=false, comments="Looks fine.") public abstract class AbstractSparseMatrix extends AbstractMTJMatrix
Modifier | Constructor and Description |
---|---|
protected |
AbstractSparseMatrix(no.uib.cipr.matrix.Matrix internalMatrix)
Creates a new instance of AbstractSparseMatrix using the given MTJ matrix
|
Modifier and Type | Method and Description |
---|---|
abstract void |
compact()
Compact the memory used by the matrix, getting rid of any zero elements
|
SparseVector |
getColumn(int columnIndex)
Gets the specified column from the zero-based index and returns a
vector that corresponds to that column.
|
SparseVector |
getRow(int rowIndex)
Gets the specified row from the zero-based index and returns a vector
that corresponds to that column
|
boolean |
isSparse()
Returns true if this matrix has a potentially sparse underlying
structure.
|
DenseMatrix |
pseudoInverse(double effectiveZero)
Computes the effective pseudo-inverse of
this , using a
rather expensive procedure (SVD) |
void |
setElement(int rowIndex,
int columnIndex,
double value)
Sets the Matrix element at the specified zero-based indices
throws ArrayIndexOutOfBoundsException if either rowIndex or columnIndex
are less than 0, or greater than the number of rows (columns) minus one
(0 <= index <= num-1)
|
SparseVector |
solve(AbstractMTJVector b)
This sparse-vector solver performs iterative solving for "x" in the
equation: this*x = b, and the AbstractSparseMatrix "this" can be
unstructured (e.g., asymmetric, indefinite, etc.)
|
SparseVector |
times(AbstractMTJVector vector)
Returns the column vector from the equation
return = this * vector
|
java.lang.String |
toString()
Creates a string in the "(Row,Column): value" for the nonzero elements
|
java.lang.String |
toString(java.text.NumberFormat format)
Converts the vector to a
String , using the given formatter. |
clone, convertFromVector, convertToVector, dotTimesEquals, dotTimesEquals, equals, get, getElement, getInternalMatrix, 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, 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
getEntryCount, getMatrixFactory, getSubMatrix, transpose
dotTimes, isZero, minus, negative, negativeEquals, plus, scale, scaledMinus, scaledMinusEquals, scaledPlus
protected AbstractSparseMatrix(no.uib.cipr.matrix.Matrix internalMatrix)
internalMatrix
- internal MTJ matrix to base this onpublic abstract void compact()
public SparseVector times(AbstractMTJVector vector)
AbstractMTJMatrix
times
in class AbstractMTJMatrix
vector
- Vector by which to post-multiply this, must have the
same number of rows as thispublic void setElement(int rowIndex, int columnIndex, double value)
Matrix
setElement
in interface Matrix
setElement
in class AbstractMTJMatrix
rowIndex
- Zero-based index into the rows of the MatrixcolumnIndex
- Zero-based index into the columns of the Matrixvalue
- Value to set at the specified indexpublic SparseVector solve(AbstractMTJVector b)
solve
in class AbstractMTJMatrix
b
- must satisfy this.getNumColumns() == b.getDimensionality()public DenseMatrix pseudoInverse(double effectiveZero)
Matrix
this
, using a
rather expensive procedure (SVD)effectiveZero
- effective zero to pass along to the SVDthis
public java.lang.String toString()
public java.lang.String toString(java.text.NumberFormat format)
Matrix
String
, using the given formatter.format
- The number format to use.public SparseVector getColumn(int columnIndex)
Matrix
columnIndex
- zero-based index into the matrixpublic SparseVector getRow(int rowIndex)
Matrix
rowIndex
- zero-based index into the matrixpublic boolean isSparse()
Matrix