org.djunits.value.vdouble.matrix

• ```public class DoubleMatrixDataDense
extends DoubleMatrixData```
Stores dense data for a DoubleMatrix and carries out basic operations.

\$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) \$, @version \$Revision: 1147 \$, by \$Author: averbraeck \$, initial version Oct 3, 2015
Author:
Alexander Verbraeck, Peter Knoppers

• ### Fields inherited from class org.djunits.value.vdouble.matrix.DoubleMatrixData

`cols, matrixSI, rows`
• ### Constructor Summary

Constructors
Constructor and Description
`DoubleMatrixDataDense(double[][] matrixSI)`
Create a matrix with dense data.
```DoubleMatrixDataDense(double[] matrixSI, int rows, int cols)```
Create a matrix with dense data.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`void` `assign(DoubleFunction doubleFunction)`
`DoubleMatrixDataDense` `copy()`
`void` `decrementBy(DoubleMatrixData right)`
Subtract a matrix from this matrix on a cell-by-cell basis.
`void` `divideBy(DoubleMatrixData right)`
Divide the values of a matrix by the values of another matrix on a cell-by-cell basis.
`double[][]` `getDenseMatrixSI()`
`double` ```getSI(int row, int col)```
`void` `incrementBy(DoubleMatrixData right)`
Add a matrix to this matrix on a cell-by-cell basis.
`void` `multiplyBy(DoubleMatrixData right)`
Multiply a matrix with the values of another matrix on a cell-by-cell basis.
`void` ```setSI(int row, int col, double valueSI)```
Sets a value at the [row, col] point in the matrix.
`DoubleMatrixDataSparse` `toSparse()`
• ### Methods inherited from class org.djunits.value.vdouble.matrix.DoubleMatrixData

`cardinality, cols, decrementBy, divide, divideBy, equals, getStorageType, hashCode, incrementBy, instantiate, instantiate, isDense, isSparse, minus, multiplyBy, plus, rows, times, toDense, toString, zSum`
• ### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

```public DoubleMatrixDataDense(double[] matrixSI,
int rows,
int cols)
throws ValueException```
Create a matrix with dense data.
Parameters:
`matrixSI` - the data to store
`rows` - the number of rows
`cols` - the number of columns
Throws:
`ValueException` - in case rows * cols != matrixSI.length

```public DoubleMatrixDataDense(double[][] matrixSI)
throws ValueException```
Create a matrix with dense data.
Parameters:
`matrixSI` - the data to store
Throws:
`ValueException` - in case matrix is ragged
• ### Method Detail

• #### assign

`public final void assign(DoubleFunction doubleFunction)`
Parameters:
`doubleFunction` - the function to apply on the (mutable) data elements
• #### toSparse

`public final DoubleMatrixDataSparse toSparse()`
Overrides:
`toSparse` in class `DoubleMatrixData`
Returns:
the sparse transformation of this data
• #### getSI

```public final double getSI(int row,
int col)```
Specified by:
`getSI` in class `DoubleMatrixData`
Parameters:
`row` - the row number to get the value for
`col` - the column number to get the value for
Returns:
the value at the [row, col] point
• #### setSI

```public final void setSI(int row,
int col,
double valueSI)```
Sets a value at the [row, col] point in the matrix.
Specified by:
`setSI` in class `DoubleMatrixData`
Parameters:
`row` - the row number to set the value for
`col` - the column number to set the value for
`valueSI` - the value at the index
• #### getDenseMatrixSI

`public final double[][] getDenseMatrixSI()`
Specified by:
`getDenseMatrixSI` in class `DoubleMatrixData`
Returns:
a safe dense copy of matrixSI as a matrix
• #### copy

`public final DoubleMatrixDataDense copy()`
Specified by:
`copy` in class `DoubleMatrixData`
Returns:
a deep copy of the data.
• #### incrementBy

```public final void incrementBy(DoubleMatrixData right)
throws ValueException```
Add a matrix to this matrix on a cell-by-cell basis. The type of matrix (sparse, dense) stays the same.
Specified by:
`incrementBy` in class `DoubleMatrixData`
Parameters:
`right` - the other data object to add
Throws:
`ValueException` - if matrices have different lengths
• #### decrementBy

```public final void decrementBy(DoubleMatrixData right)
throws ValueException```
Subtract a matrix from this matrix on a cell-by-cell basis. The type of matrix (sparse, dense) stays the same.
Specified by:
`decrementBy` in class `DoubleMatrixData`
Parameters:
`right` - the other data object to subtract
Throws:
`ValueException` - if matrices have different lengths
• #### multiplyBy

```public final void multiplyBy(DoubleMatrixData right)
throws ValueException```
Multiply a matrix with the values of another matrix on a cell-by-cell basis. The type of matrix (sparse, dense) stays the same.
Specified by:
`multiplyBy` in class `DoubleMatrixData`
Parameters:
`right` - the other data object to multiply with
Throws:
`ValueException` - if matrices have different lengths
• #### divideBy

```public final void divideBy(DoubleMatrixData right)
throws ValueException```
Divide the values of a matrix by the values of another matrix on a cell-by-cell basis. The type of matrix (sparse, dense) stays the same.
Specified by:
`divideBy` in class `DoubleMatrixData`
Parameters:
`right` - the other data object to divide by
Throws:
`ValueException` - if matrices have different lengths