|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.linear.AbstractRealMatrix
org.apache.commons.math.linear.OpenMapRealMatrix
public class OpenMapRealMatrix
Sparse matrix implementation based on an open addressed map.
Field Summary | |
---|---|
private int |
columns
Number of columns of the matrix. |
private OpenIntToDoubleHashMap |
entries
Storage for (sparse) matrix elements. |
private int |
rows
Number of rows of the matrix. |
private static long |
serialVersionUID
Serializable version identifier. |
Constructor Summary | |
---|---|
OpenMapRealMatrix(int rowDimension,
int columnDimension)
Build a sparse matrix with the supplied row and column dimensions. |
|
OpenMapRealMatrix(OpenMapRealMatrix matrix)
Build a matrix by copying another one. |
Method Summary | |
---|---|
OpenMapRealMatrix |
add(OpenMapRealMatrix m)
Compute the sum of this and m . |
OpenMapRealMatrix |
add(RealMatrix m)
Compute the sum of this and m. |
void |
addToEntry(int row,
int column,
double increment)
Change an entry in the specified row and column. |
private int |
computeKey(int row,
int column)
Compute the key to access a matrix element |
OpenMapRealMatrix |
copy()
Returns a (deep) copy of this. |
OpenMapRealMatrix |
createMatrix(int rowDimension,
int columnDimension)
Create a new RealMatrix of the same type as the instance with the supplied row and column dimensions. |
int |
getColumnDimension()
Returns the number of columns in the matrix. |
double |
getEntry(int row,
int column)
Returns the entry in the specified row and column. |
int |
getRowDimension()
Returns the number of rows in the matrix. |
OpenMapRealMatrix |
multiply(OpenMapRealMatrix m)
Returns the result of postmultiplying this by m. |
RealMatrix |
multiply(RealMatrix m)
Returns the result of postmultiplying this by m. |
void |
multiplyEntry(int row,
int column,
double factor)
Change an entry in the specified row and column. |
void |
setEntry(int row,
int column,
double value)
Set the entry in the specified row and column. |
OpenMapRealMatrix |
subtract(OpenMapRealMatrix m)
Compute this minus m . |
OpenMapRealMatrix |
subtract(RealMatrix m)
Compute this minus m. |
Methods inherited from class org.apache.commons.math.linear.AbstractRealMatrix |
---|
copySubMatrix, copySubMatrix, equals, getColumn, getColumnMatrix, getColumnVector, getData, getDeterminant, getFrobeniusNorm, getNorm, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, hashCode, inverse, isSingular, isSquare, luDecompose, operate, operate, preMultiply, preMultiply, preMultiply, scalarAdd, scalarMultiply, setColumn, setColumnMatrix, setColumnVector, setRow, setRowMatrix, setRowVector, setSubMatrix, solve, solve, toString, transpose, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.math.linear.RealMatrix |
---|
copySubMatrix, copySubMatrix, getColumn, getColumnMatrix, getColumnVector, getData, getDeterminant, getFrobeniusNorm, getNorm, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, inverse, isSingular, operate, operate, preMultiply, preMultiply, preMultiply, scalarAdd, scalarMultiply, setColumn, setColumnMatrix, setColumnVector, setRow, setRowMatrix, setRowVector, setSubMatrix, solve, solve, transpose, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder |
Methods inherited from interface org.apache.commons.math.linear.AnyMatrix |
---|
isSquare |
Field Detail |
---|
private static final long serialVersionUID
private final int rows
private final int columns
private final OpenIntToDoubleHashMap entries
Constructor Detail |
---|
public OpenMapRealMatrix(int rowDimension, int columnDimension)
rowDimension
- number of rows of the matrixcolumnDimension
- number of columns of the matrixpublic OpenMapRealMatrix(OpenMapRealMatrix matrix)
matrix
- matrix to copyMethod Detail |
---|
public OpenMapRealMatrix copy()
copy
in interface RealMatrix
copy
in class AbstractRealMatrix
public OpenMapRealMatrix createMatrix(int rowDimension, int columnDimension) throws java.lang.IllegalArgumentException
createMatrix
in interface RealMatrix
createMatrix
in class AbstractRealMatrix
rowDimension
- the number of rows in the new matrixcolumnDimension
- the number of columns in the new matrix
java.lang.IllegalArgumentException
- if row or column dimension is not positivepublic int getColumnDimension()
getColumnDimension
in interface AnyMatrix
getColumnDimension
in class AbstractRealMatrix
public OpenMapRealMatrix add(RealMatrix m) throws java.lang.IllegalArgumentException
add
in interface RealMatrix
add
in class AbstractRealMatrix
m
- matrix to be added
java.lang.IllegalArgumentException
- if m is not the same size as thispublic OpenMapRealMatrix add(OpenMapRealMatrix m) throws java.lang.IllegalArgumentException
m
.
m
- matrix to be added
java.lang.IllegalArgumentException
- if m is not the same size as thispublic OpenMapRealMatrix subtract(RealMatrix m) throws java.lang.IllegalArgumentException
subtract
in interface RealMatrix
subtract
in class AbstractRealMatrix
m
- matrix to be subtracted
java.lang.IllegalArgumentException
- if m is not the same size as thispublic OpenMapRealMatrix subtract(OpenMapRealMatrix m) throws java.lang.IllegalArgumentException
m
.
m
- matrix to be subtracted
java.lang.IllegalArgumentException
- if m is not the same size as thispublic RealMatrix multiply(RealMatrix m) throws java.lang.IllegalArgumentException
multiply
in interface RealMatrix
multiply
in class AbstractRealMatrix
m
- matrix to postmultiply by
java.lang.IllegalArgumentException
- if columnDimension(this) != rowDimension(m)public OpenMapRealMatrix multiply(OpenMapRealMatrix m) throws java.lang.IllegalArgumentException
m
- matrix to postmultiply by
java.lang.IllegalArgumentException
- if columnDimension(this) != rowDimension(m)public double getEntry(int row, int column) throws MatrixIndexException
Row and column indices start at 0 and must satisfy
0 <= row < rowDimension
0 <= column < columnDimension
MatrixIndexException
is thrown.
getEntry
in interface RealMatrix
getEntry
in class AbstractRealMatrix
row
- row location of entry to be fetchedcolumn
- column location of entry to be fetched
MatrixIndexException
- if the row or column index is not validpublic int getRowDimension()
getRowDimension
in interface AnyMatrix
getRowDimension
in class AbstractRealMatrix
public void setEntry(int row, int column, double value) throws MatrixIndexException
Row and column indices start at 0 and must satisfy
0 <= row < rowDimension
0 <= column < columnDimension
MatrixIndexException
is thrown.
setEntry
in interface RealMatrix
setEntry
in class AbstractRealMatrix
row
- row location of entry to be setcolumn
- column location of entry to be setvalue
- matrix entry to be set in row,column
MatrixIndexException
- if the row or column index is not validpublic void addToEntry(int row, int column, double increment) throws MatrixIndexException
Row and column indices start at 0 and must satisfy
0 <= row < rowDimension
0 <= column < columnDimension
MatrixIndexException
is thrown.
addToEntry
in interface RealMatrix
addToEntry
in class AbstractRealMatrix
row
- row location of entry to be setcolumn
- column location of entry to be setincrement
- value to add to the current matrix entry in row,column
MatrixIndexException
- if the row or column index is not validpublic void multiplyEntry(int row, int column, double factor) throws MatrixIndexException
Row and column indices start at 0 and must satisfy
0 <= row < rowDimension
0 <= column < columnDimension
MatrixIndexException
is thrown.
multiplyEntry
in interface RealMatrix
multiplyEntry
in class AbstractRealMatrix
row
- row location of entry to be setcolumn
- column location of entry to be setfactor
- multiplication factor for the current matrix entry in row,column
MatrixIndexException
- if the row or column index is not validprivate int computeKey(int row, int column)
row
- row index of the matrix elementcolumn
- column index of the matrix element
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |