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 and 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 and 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. |
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. |
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, walkInRowOrderisTransposable, operateTransposeclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, 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, walkInRowOrderpublic OpenMapRealMatrix(int rowDimension,
int columnDimension)
throws NotStrictlyPositiveException,
NumberIsTooLargeException
rowDimension - Number of rows of the matrix.columnDimension - Number of columns of the matrix.NotStrictlyPositiveException - if row or column dimension is not
positive.NumberIsTooLargeException - 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 RealMatrixcopy in class AbstractRealMatrixpublic OpenMapRealMatrix createMatrix(int rowDimension, int columnDimension) throws NotStrictlyPositiveException, NumberIsTooLargeException
createMatrix in interface RealMatrixcreateMatrix in class AbstractRealMatrixrowDimension - the number of rows in the new matrixcolumnDimension - the number of columns in the new matrixNumberIsTooLargeException - if the total number of entries of the
matrix is larger than Integer.MAX_VALUE.NotStrictlyPositiveException - if row or column dimension is not
positive.public int getColumnDimension()
getColumnDimension in interface AnyMatrixgetColumnDimension in class AbstractRealMatrixpublic OpenMapRealMatrix add(OpenMapRealMatrix m) throws MatrixDimensionMismatchException
m.m - Matrix to be added.this + m.MatrixDimensionMismatchException - if m is not the same
size as this.public OpenMapRealMatrix subtract(RealMatrix m) throws MatrixDimensionMismatchException
this minus m.subtract in interface RealMatrixsubtract in class AbstractRealMatrixm - matrix to be subtractedthis - mMatrixDimensionMismatchException - if m is not the same
size as this.public OpenMapRealMatrix subtract(OpenMapRealMatrix m) throws MatrixDimensionMismatchException
m from this matrix.m - Matrix to be subtracted.this - m.MatrixDimensionMismatchException - if m is not the same
size as this.public RealMatrix multiply(RealMatrix m) throws DimensionMismatchException, NumberIsTooLargeException
this by m.multiply in interface RealMatrixmultiply in class AbstractRealMatrixm - matrix to postmultiply bythis * mNumberIsTooLargeException - if m is an
OpenMapRealMatrix, and the total number of entries of the product
is larger than Integer.MAX_VALUE.DimensionMismatchException - if
columnDimension(this) != rowDimension(m)public OpenMapRealMatrix multiply(OpenMapRealMatrix m) throws DimensionMismatchException, NumberIsTooLargeException
m.m - Matrix to postmultiply by.this * m.DimensionMismatchException - if the number of rows of m
differ from the number of columns of this matrix.NumberIsTooLargeException - if the total number of entries of the
product is larger than Integer.MAX_VALUE.public double getEntry(int row,
int column)
throws OutOfRangeException
getEntry in interface RealMatrixgetEntry in class AbstractRealMatrixrow - Row index of entry to be fetched.column - Column index of entry to be fetched.(row, column).OutOfRangeException - if the row or column index is not valid.public int getRowDimension()
getRowDimension in interface AnyMatrixgetRowDimension in class AbstractRealMatrixpublic void setEntry(int row,
int column,
double value)
throws OutOfRangeException
setEntry in interface RealMatrixsetEntry in class AbstractRealMatrixrow - Row index of entry to be set.column - Column index of entry to be set.value - the new value of the entry.OutOfRangeException - if the row or column index is not validpublic void addToEntry(int row,
int column,
double increment)
throws OutOfRangeException
this matrix. Row and column indices start at 0.addToEntry in interface RealMatrixaddToEntry in class AbstractRealMatrixrow - 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.OutOfRangeException - if the row or column index is not valid.public void multiplyEntry(int row,
int column,
double factor)
throws OutOfRangeException
this matrix by the
specified value. Row and column indices start at 0.multiplyEntry in interface RealMatrixmultiplyEntry in class AbstractRealMatrixrow - Row index of the entry to be modified.column - Column index of the entry to be modified.factor - Multiplication factor for the matrix entry.OutOfRangeException - if the row or column index is not valid.Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.