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.
| Modifier and Type | Field and Description |
|---|---|
| private final int | columns
Number of columns of the matrix. |
| private final OpenIntToDoubleHashMap | entries
Storage for (sparse) matrix elements. |
| private final int | rows
Number of rows of the matrix. |
| private static final long | serialVersionUID
Serializable version identifier. |
| Access | Constructor and Description |
|---|---|
| public | OpenMapRealMatrix(int
Number of rows of the matrix. rowDimension, int Number of columns of the matrix. columnDimension)Build a sparse matrix with the supplied row and column dimensions. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public OpenMapRealMatrix | |
| public void | addToEntry(int
Row index of the entry to be modified. row, int Column index of the entry to be modified. column, double value to add to the matrix entry. increment)Overrides org. Implements org. Adds (in place) the specified value to the specified entry of
|
| private int | Returns: key within the map to access the matrix elementrow index of the matrix element row, int column index of the matrix element column)Compute the key to access a matrix element |
| public OpenMapRealMatrix | copy()
Implements abstract org. Implements org. Returns a (deep) copy of this. |
| public OpenMapRealMatrix | createMatrix(int
the number of rows in the new matrix rowDimension, int the number of columns in the new matrix columnDimension)Implements abstract org. Implements org. Create a new RealMatrix of the same type as the instance with the supplied row and column dimensions. |
| public int | getColumnDimension()
Implements abstract org. Implements org. Returns the number of columns in the matrix. |
| public double | getEntry(int
Row index of entry to be fetched. row, int Column index of entry to be fetched. column)Implements abstract org. Implements org. Get the entry in the specified row and column. |
| public int | getRowDimension()
Implements abstract org. Implements org. Returns the number of rows in the matrix. |
| public RealMatrix | multiply(final RealMatrix
matrix to postmultiply by m)Overrides org. Implements org. Returns the result of postmultiplying |
| public OpenMapRealMatrix | Returns: this * m.Matrix to postmultiply by. m)Postmultiply this matrix by |
| public void | multiplyEntry(int
Row index of the entry to be modified. row, int Column index of the entry to be modified. column, double Multiplication factor for the matrix entry. factor)Overrides org. Implements org. Multiplies (in place) the specified entry of |
| public void | setEntry(int
Row index of entry to be set. row, int Column index of entry to be set. column, double the new value of the entry. value)Implements abstract org. Implements org. Set the entry in the specified row and column. |
| public OpenMapRealMatrix | subtract(final RealMatrix
matrix to be subtracted m)Overrides org. Implements org. Returns |
| public OpenMapRealMatrix |
| columns | back to summary |
|---|---|
| private final int columns Number of columns of the matrix. | |
| entries | back to summary |
|---|---|
| private final OpenIntToDoubleHashMap entries Storage for (sparse) matrix elements. | |
| rows | back to summary |
|---|---|
| private final int rows Number of rows of the matrix. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serializable version identifier. | |
| OpenMapRealMatrix | back to summary |
|---|---|
| public OpenMapRealMatrix(int rowDimension, int columnDimension) throws NotStrictlyPositiveException, NumberIsTooLargeException Build a sparse matrix with the supplied row and column dimensions.
| |
| OpenMapRealMatrix | back to summary |
|---|---|
| public OpenMapRealMatrix(OpenMapRealMatrix matrix) Build a matrix by copying another one.
| |
| add | back to summary |
|---|---|
| public OpenMapRealMatrix add(OpenMapRealMatrix m) throws MatrixDimensionMismatchException Compute the sum of this matrix and
| |
| addToEntry | back to summary |
|---|---|
| public void addToEntry(int row, int column, double increment) throws OutOfRangeException Overrides org. Implements org. Doc from org. Adds (in place) the specified value to the specified entry of
| |
| computeKey | back to summary |
|---|---|
| private int computeKey(int row, int column) Compute the key to access a matrix element
| |
| copy | back to summary |
|---|---|
| public OpenMapRealMatrix copy() Implements abstract org. Implements org. Doc from org. Returns a (deep) copy of this.
| |
| createMatrix | back to summary |
|---|---|
| public OpenMapRealMatrix createMatrix(int rowDimension, int columnDimension) throws NotStrictlyPositiveException, NumberIsTooLargeException Implements abstract org. Implements org. Doc from org. Create a new RealMatrix of the same type as the instance with the supplied row and column dimensions.
| |
| getColumnDimension | back to summary |
|---|---|
| public int getColumnDimension() Implements abstract org. Implements org. Doc from org. Returns the number of columns in the matrix.
| |
| getEntry | back to summary |
|---|---|
| public double getEntry(int row, int column) throws OutOfRangeException Implements abstract org. Implements org. Doc from org. Get the entry in the specified row and column. Row and column indices start at 0.
| |
| getRowDimension | back to summary |
|---|---|
| public int getRowDimension() Implements abstract org. Implements org. Doc from org. Returns the number of rows in the matrix.
| |
| multiply | back to summary |
|---|---|
| public RealMatrix multiply(final RealMatrix m) throws DimensionMismatchException, NumberIsTooLargeException Overrides org. Implements org. Doc from org. Returns the result of postmultiplying
| |
| multiply | back to summary |
|---|---|
| public OpenMapRealMatrix multiply(OpenMapRealMatrix m) throws DimensionMismatchException, NumberIsTooLargeException Postmultiply this matrix by
| |
| multiplyEntry | back to summary |
|---|---|
| public void multiplyEntry(int row, int column, double factor) throws OutOfRangeException Overrides org. Implements org. Doc from org. Multiplies (in place) the specified entry of
| |
| setEntry | back to summary |
|---|---|
| public void setEntry(int row, int column, double value) throws OutOfRangeException Implements abstract org. Implements org. Doc from org. Set the entry in the specified row and column. Row and column indices start at 0.
| |
| subtract | back to summary |
|---|---|
| public OpenMapRealMatrix subtract(final RealMatrix m) throws MatrixDimensionMismatchException Overrides org. Implements org. Doc from org. Returns
| |
| subtract | back to summary |
|---|---|
| public OpenMapRealMatrix subtract(OpenMapRealMatrix m) throws MatrixDimensionMismatchException Subtract
| |