• All Implemented Interfaces:
`Serializable`, `Cloneable`

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

Author:
Alexander Verbraeck, Peter Knoppers
Serialized Form

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

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

Constructors
Constructor 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 Description
`DoubleMatrixDataDense` `assign​(DoubleFunction doubleFunction)`
Apply an operation to each cell.
`DoubleMatrixDataDense` ```assign​(DoubleFunction2 doubleFunction, DoubleMatrixData right)```
Apply a binary operation on a cell by cell basis.
`int` `cardinality()`
Compute and return the number of non-zero cells in this indexed value.
`DoubleMatrixDataDense` `copy()`
Create and return a deep copy of the data.
`DoubleMatrixData` `divide​(DoubleMatrixData right)`
Divide two matrices on a cell-by-cell basis.
`double[][]` `getDenseMatrixSI()`
Create and return a deep copy of the data in dense format.
`double` ```getSI​(int row, int col)```
Retrieve one value from this data.
`DoubleMatrixDataDense` `minus​(DoubleMatrixData right)`
Subtract two matrices on a cell-by-cell basis.
`DoubleMatrixData` `plus​(DoubleMatrixData right)`
Add two matrices 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.
`DoubleMatrixData` `times​(DoubleMatrixData right)`
Multiply two matrices on a cell-by-cell basis.
`DoubleMatrixDataDense` `toDense()`
Return the data of this matrix in dense storage format.
`DoubleMatrixDataSparse` `toSparse()`
Return the data of this matrix in sparse storage format.
`String` `toString()`
• ### Methods inherited from class org.djunits.value.vdouble.matrix.data.DoubleMatrixData

`checkRectangularAndNonNull, checkRectangularAndNonNull, checkSizes, cols, compareDenseMatrixWithSparseMatrix, decrementBy, divideBy, equals, hashCode, incrementBy, instantiate, instantiate, instantiate, multiplyBy, rows, zSum`
• ### Methods inherited from class org.djunits.value.storage.AbstractStorage

`getStorageType, isDense, isSparse`
• ### 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 ValueRuntimeException```
Create a matrix with dense data.
Parameters:
`matrixSI` - double[]; the data to store
`rows` - int; the number of rows
`cols` - int; the number of columns
Throws:
`ValueRuntimeException` - in case `rows * cols != matrixSI.length`

```public DoubleMatrixDataDense​(double[][] matrixSI)
throws ValueRuntimeException```
Create a matrix with dense data. The double array is of the form d[rows][columns] so each value can be found with d[row][column].
Parameters:
`matrixSI` - double[][]; the data to store
Throws:
`NullPointerException` - when matrixSI is null
`ValueRuntimeException` - in case matrix is ragged
• ### Method Detail

• #### cardinality

`public final int cardinality()`
Compute and return the number of non-zero cells in this indexed value.
Specified by:
`cardinality` in class `AbstractStorage<DoubleMatrixData>`
Returns:
int; the number of non-zero cells
• #### assign

`public final DoubleMatrixDataDense assign​(DoubleFunction doubleFunction)`
Apply an operation to each cell.
Specified by:
`assign` in class `DoubleMatrixData`
Parameters:
`doubleFunction` - DoubleFunction; the operation to apply
Returns:
DoubleMatrixData; this (modified) double matrix data object
• #### assign

```public final DoubleMatrixDataDense assign​(DoubleFunction2 doubleFunction,
DoubleMatrixData right)```
Apply a binary operation on a cell by cell basis.
Specified by:
`assign` in class `DoubleMatrixData`
Parameters:
`doubleFunction` - DoubleFunction2; the binary operation to apply
`right` - DoubleMatrixData; the right operand for the binary operation
Returns:
DoubleMatrixData; this (modified) double matrix data object
• #### toDense

`public final DoubleMatrixDataDense toDense()`
Return the data of this matrix in dense storage format.
Specified by:
`toDense` in class `DoubleMatrixData`
Returns:
DoubleMatrixDataDense; the dense transformation of this data
• #### toSparse

`public final DoubleMatrixDataSparse toSparse()`
Return the data of this matrix in sparse storage format.
Specified by:
`toSparse` in class `DoubleMatrixData`
Returns:
DoubleMatrixDataSparse; the sparse transformation of this data
• #### getSI

```public final double getSI​(int row,
int col)```
Retrieve one value from this data.
Specified by:
`getSI` in class `DoubleMatrixData`
Parameters:
`row` - int; the row number to get the value for
`col` - int; 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` - int; the row number to set the value for
`col` - int; the column number to set the value for
`valueSI` - double; the value at the index
• #### getDenseMatrixSI

`public final double[][] getDenseMatrixSI()`
Create and return a deep copy of the data in dense format. The double array is of the form d[rows][columns] so each value can be found with d[row][column].
Specified by:
`getDenseMatrixSI` in class `DoubleMatrixData`
Returns:
double[][]; a safe, dense copy of matrixSI as a matrix
• #### copy

`public final DoubleMatrixDataDense copy()`
Create and return a deep copy of the data.
Specified by:
`copy` in class `AbstractStorage<DoubleMatrixData>`
Returns:
T; a deep copy of the data
• #### plus

```public DoubleMatrixData plus​(DoubleMatrixData right)
throws ValueRuntimeException```
Add two matrices on a cell-by-cell basis. If both matrices are sparse, a sparse matrix is returned, otherwise a dense matrix is returned.
Specified by:
`plus` in class `DoubleMatrixData`
Parameters:
`right` - DoubleMatrixData; the other data object to add
Returns:
the sum of this data object and the other data object
Throws:
`ValueRuntimeException` - if matrices have different lengths
• #### minus

`public final DoubleMatrixDataDense minus​(DoubleMatrixData right)`
Subtract two matrices on a cell-by-cell basis. If both matrices are sparse, a sparse matrix is returned, otherwise a dense matrix is returned.
Specified by:
`minus` in class `DoubleMatrixData`
Parameters:
`right` - DoubleMatrixData; the other data object to subtract
Returns:
the sum of this data object and the other data object
• #### times

```public DoubleMatrixData times​(DoubleMatrixData right)
throws ValueRuntimeException```
Multiply two matrices on a cell-by-cell basis. If both matrices are dense, a dense matrix is returned, otherwise a sparse matrix is returned.
Specified by:
`times` in class `DoubleMatrixData`
Parameters:
`right` - DoubleMatrixData; the other data object to multiply with
Returns:
DoubleVectorData; a new double matrix data store holding the result of the multiplications
Throws:
`ValueRuntimeException` - if matrices have different sizes
• #### divide

```public DoubleMatrixData divide​(DoubleMatrixData right)
throws ValueRuntimeException```
Divide two matrices on a cell-by-cell basis. If this matrix is sparse and `right` is dense, a sparse matrix is returned, otherwise a dense matrix is returned.
Specified by:
`divide` in class `DoubleMatrixData`
Parameters:
`right` - DoubleMatrixData; the other data object to divide by
Returns:
DoubleMatrixData; the ratios of the values of this data object and the other data object
Throws:
`ValueRuntimeException` - if matrices have different sizes
• #### toString

`public String toString()`
Overrides:
`toString` in class `Object`