Serializable
, AnyMatrix
, RealLinearOperator
, RealMatrix
, SparseRealMatrix
public class OpenMapRealMatrix extends AbstractRealMatrix implements SparseRealMatrix, Serializable
Caveat: This implementation assumes that, for any x
,
the equality x * 0d == 0d
holds. But it is is not true for
NaN
. Moreover, zero entries will lose their sign.
Some operations (that involve NaN
and/or infinities) may
thus give incorrect results.
Constructor | Description |
---|---|
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.
|
Modifier and Type | Method | Description |
---|---|---|
OpenMapRealMatrix |
add(OpenMapRealMatrix m) |
Compute the sum of this matrix and
m . |
void |
addToEntry(int row,
int column,
double increment) |
Adds (in place) the specified value to the specified entry of
this matrix. |
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 of this matrix.
|
double |
getEntry(int row,
int column) |
Get the entry in the specified row and column.
|
int |
getRowDimension() |
Returns the number of rows of this matrix.
|
OpenMapRealMatrix |
multiply(OpenMapRealMatrix m) |
Postmultiply this matrix by
m . |
RealMatrix |
multiply(RealMatrix m) |
Returns the result of postmultiplying
this by m . |
void |
multiplyEntry(int row,
int column,
double factor) |
Multiplies (in place) the specified entry of
this matrix by the
specified value. |
RealMatrix |
multiplyTransposed(RealMatrix m) |
Returns the result of postmultiplying
this by m^T . |
void |
setEntry(int row,
int column,
double value) |
Set the entry in the specified row and column.
|
OpenMapRealMatrix |
subtract(OpenMapRealMatrix m) |
Subtract
m from this matrix. |
OpenMapRealMatrix |
subtract(RealMatrix m) |
Returns
this minus m . |
RealMatrix |
transposeMultiply(RealMatrix m) |
Returns the result of postmultiplying
this^T by m . |
add, copySubMatrix, copySubMatrix, equals, getColumn, getColumnMatrix, getColumnVector, getData, getFrobeniusNorm, getNorm, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, hashCode, isSquare, operate, operate, power, preMultiply, preMultiply, preMultiply, scalarAdd, scalarMultiply, setColumn, setColumnMatrix, setColumnVector, setRow, setRowMatrix, setRowVector, setSubMatrix, toString, transpose, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isTransposable, operateTranspose
add, copySubMatrix, copySubMatrix, getColumn, getColumnMatrix, getColumnVector, getData, getFrobeniusNorm, getNorm, getRow, getRowMatrix, getRowVector, getSubMatrix, getSubMatrix, getTrace, operate, operate, power, preMultiply, preMultiply, preMultiply, scalarAdd, scalarMultiply, setColumn, setColumnMatrix, setColumnVector, setRow, setRowMatrix, setRowVector, setSubMatrix, transpose, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInColumnOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInOptimizedOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder, walkInRowOrder
public OpenMapRealMatrix(int rowDimension, int columnDimension) throws MathIllegalArgumentException
rowDimension
- Number of rows of the matrix.columnDimension
- Number of columns of the matrix.MathIllegalArgumentException
- if row or column dimension is not
positive.MathIllegalArgumentException
- if the total number of entries of the
matrix is larger than Integer.MAX_VALUE
.public OpenMapRealMatrix(OpenMapRealMatrix matrix)
matrix
- matrix to copy.public OpenMapRealMatrix copy()
copy
in interface RealMatrix
copy
in class AbstractRealMatrix
public OpenMapRealMatrix createMatrix(int rowDimension, int columnDimension) throws MathIllegalArgumentException
createMatrix
in interface RealMatrix
createMatrix
in class AbstractRealMatrix
rowDimension
- the number of rows in the new matrixcolumnDimension
- the number of columns in the new matrixMathIllegalArgumentException
- if the total number of entries of the
matrix is larger than Integer.MAX_VALUE
.public int getColumnDimension()
getColumnDimension
in interface AnyMatrix
getColumnDimension
in interface RealLinearOperator
getColumnDimension
in class AbstractRealMatrix
public OpenMapRealMatrix add(OpenMapRealMatrix m) throws MathIllegalArgumentException
m
.m
- Matrix to be added.this
+ m
.MathIllegalArgumentException
- if m
is not the same
size as this
.public OpenMapRealMatrix subtract(RealMatrix m) throws MathIllegalArgumentException
this
minus m
.subtract
in interface RealMatrix
subtract
in class AbstractRealMatrix
m
- matrix to be subtractedthis - m
MathIllegalArgumentException
- if m
is not the same
size as this
.public OpenMapRealMatrix subtract(OpenMapRealMatrix m) throws MathIllegalArgumentException
m
from this matrix.m
- Matrix to be subtracted.this
- m
.MathIllegalArgumentException
- if m
is not the same
size as this
.public RealMatrix multiply(RealMatrix m) throws MathIllegalArgumentException
this
by m
.multiply
in interface RealMatrix
multiply
in class AbstractRealMatrix
m
- matrix to postmultiply bythis * m
MathIllegalArgumentException
- if m
is an
OpenMapRealMatrix
, and the total number of entries of the product
is larger than Integer.MAX_VALUE
.public RealMatrix multiplyTransposed(RealMatrix m) throws MathIllegalArgumentException
this
by m^T
.
This is equivalent to call multiply
(m.RealMatrix.transpose()
),
but some implementations may avoid building the intermediate transposed matrix.
multiplyTransposed
in interface RealMatrix
m
- matrix to first transpose and second postmultiply bythis * m^T
MathIllegalArgumentException
- if m
is an
OpenMapRealMatrix
, and the total number of entries of the product
is larger than Integer.MAX_VALUE
.public RealMatrix transposeMultiply(RealMatrix m) throws MathIllegalArgumentException
this^T
by m
.
This is equivalent to call RealMatrix.transpose()
.multiply(m)
,
but some implementations may avoid building the intermediate transposed matrix.
transposeMultiply
in interface RealMatrix
m
- matrix to postmultiply bythis^T * m
MathIllegalArgumentException
- if m
is an
OpenMapRealMatrix
, and the total number of entries of the product
is larger than Integer.MAX_VALUE
.public OpenMapRealMatrix multiply(OpenMapRealMatrix m) throws MathIllegalArgumentException
m
.m
- Matrix to postmultiply by.this
* m
.MathIllegalArgumentException
- if the number of rows of m
differ from the number of columns of this
matrix.MathIllegalArgumentException
- if the total number of entries of the
product is larger than Integer.MAX_VALUE
.public double getEntry(int row, int column) throws MathIllegalArgumentException
getEntry
in interface RealMatrix
getEntry
in class AbstractRealMatrix
row
- Row index of entry to be fetched.column
- Column index of entry to be fetched.(row, column)
.MathIllegalArgumentException
- if the row or column index is not valid.public int getRowDimension()
getRowDimension
in interface AnyMatrix
getRowDimension
in interface RealLinearOperator
getRowDimension
in class AbstractRealMatrix
public void setEntry(int row, int column, double value) throws MathIllegalArgumentException
setEntry
in interface RealMatrix
setEntry
in class AbstractRealMatrix
row
- Row index of entry to be set.column
- Column index of entry to be set.value
- the new value of the entry.MathIllegalArgumentException
- if the row or column index is not validpublic void addToEntry(int row, int column, double increment) throws MathIllegalArgumentException
this
matrix. Row and column indices start at 0.addToEntry
in interface RealMatrix
addToEntry
in class AbstractRealMatrix
row
- Row index of the entry to be modified.column
- Column index of the entry to be modified.increment
- value to add to the matrix entry.MathIllegalArgumentException
- if the row or column index is not valid.public void multiplyEntry(int row, int column, double factor) throws MathIllegalArgumentException
this
matrix by the
specified value. Row and column indices start at 0.multiplyEntry
in interface RealMatrix
multiplyEntry
in class AbstractRealMatrix
row
- Row index of the entry to be modified.column
- Column index of the entry to be modified.factor
- Multiplication factor for the matrix entry.MathIllegalArgumentException
- if the row or column index is not valid.Copyright © 2016–2018 Hipparchus.org. All rights reserved.