ch.akuhn.matrix

## Class DenseMatrix

• Direct Known Subclasses:
SymmetricMatrix

```public class DenseMatrix
extends Matrix```
A Dense matrix.
Author:
• ### Field Summary

Fields
Modifier and Type Field and Description
`protected double[][]` `values`
• ### Constructor Summary

Constructors
Constructor and Description
`DenseMatrix(double[][] values)`
Construct with the given values
```DenseMatrix(int rows, int columns)```
Construct with the given size
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double` ```add(int row, int column, double value)```
Add to the value at the given row/column
`void` `applyMultiplication(double d)`
Inline multiplication by a constant
`protected void` `assertInvariant()`
`int` `columnCount()`
Get the number of columns
`void` `fill(double constant)`
Fill with a constant
`double` ```get(int row, int column)```
`protected double[][]` ```makeValues(int rows, int columns)```
`Matrix` ```newInstance(int rows, int cols)```
`double` ```put(int row, int column, double value)```
Set the value at the given row/column
`int` `rowCount()`
`Iterable<Vector>` `rows()`
Get an `Iterable` over the rows
`double[][]` `unwrap()`
`int` `used()`
• ### Methods inherited from class ch.akuhn.matrix.Matrix

`asArray, asColumnMajorArray, column, columns, dense, density, elementCount, from, getHistogram, indexOf, isSquare, max, mean, min, mult, newInstance, row, rowwiseMean, sparse, storeSparseOn, storeSparseOn, toString, transposeMultiply, transposeNonTransposeMultiply`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Field Detail

• #### values

`protected double[][] values`
• ### Constructor Detail

• #### DenseMatrix

`public DenseMatrix(double[][] values)`
Construct with the given values
Parameters:
`values` - the values
• #### DenseMatrix

```public DenseMatrix(int rows,
int columns)```
Construct with the given size
Parameters:
`rows` -
`columns` -
• ### Method Detail

• #### assertInvariant

```protected void assertInvariant()
throws IllegalArgumentException```
Throws:
`IllegalArgumentException`
• #### makeValues

```protected double[][] makeValues(int rows,
int columns)```

```public double add(int row,
int column,
double value)```
Description copied from class: `Matrix`
Add to the value at the given row/column
Overrides:
`add` in class `Matrix`
Returns:
the new value
• #### columnCount

`public int columnCount()`
Description copied from class: `Matrix`
Get the number of columns
Specified by:
`columnCount` in class `Matrix`
Returns:
the number of columns
• #### get

```public double get(int row,
int column)```
Specified by:
`get` in class `Matrix`
Returns:
the value at the given row and column
• #### put

```public double put(int row,
int column,
double value)```
Description copied from class: `Matrix`
Set the value at the given row/column
Specified by:
`put` in class `Matrix`
Returns:
the value being set
• #### rows

`public Iterable<Vector> rows()`
Description copied from class: `Matrix`
Get an `Iterable` over the rows
Overrides:
`rows` in class `Matrix`
Returns:
an `Iterable` over the rows
• #### rowCount

`public int rowCount()`
Specified by:
`rowCount` in class `Matrix`
Returns:
the number of rows
• #### used

`public int used()`
Specified by:
`used` in class `Matrix`
Returns:
the number of non-zero elements
• #### unwrap

`public double[][] unwrap()`
Overrides:
`unwrap` in class `Matrix`
Returns:
unwrapped matrix
• #### fill

`public void fill(double constant)`
Fill with a constant
Parameters:
`constant` -
• #### applyMultiplication

`public void applyMultiplication(double d)`
Inline multiplication by a constant
Parameters:
`d` -
• #### newInstance

```public Matrix newInstance(int rows,
int cols)```
Specified by:
`newInstance` in class `Matrix`
Returns:
an empty instance of this matrix type