org.openimaj.math.matrix

• ```public class JamaDenseMatrix
extends Matrix```
Dense matrix wrapper for a JAMA matrix.
Author:
Jonathon Hare (jsh2@ecs.soton.ac.uk)
• ### Field Summary

Fields
Modifier and Type Field and Description
`Jama.Matrix` `matrix`
The underlying matrix
• ### Constructor Summary

Constructors
Constructor and Description
`JamaDenseMatrix(double[][] values)`
Construct with 2d array of data.
```JamaDenseMatrix(int rows, int columns)```
Construct with given dimensions.
`JamaDenseMatrix(Jama.Matrix matrix)`
Construct with matrix.
• ### 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)`
Multiply all elements by a constant.
`double[][]` `asArray()`
Get the matrix data as a 2D dense array
`protected void` `assertInvariant()`
`int` `columnCount()`
Get the number of columns
`void` `fill(double constant)`
Fill the elements with a constant value.
`double` ```get(int row, int column)```
`Jama.Matrix` `getMatrix()`
`Matrix` ```newInstance(int rows, int cols)```
`double` ```put(int row, int column, double value)```
Set the value at the given row/column
`int` `rowCount()`
`double[][]` `unwrap()`
`int` `used()`
• ### Methods inherited from class ch.akuhn.matrix.Matrix

`asColumnMajorArray, column, columns, dense, density, elementCount, from, getHistogram, indexOf, isSquare, max, mean, min, mult, newInstance, row, rows, 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

• #### matrix

`public Jama.Matrix matrix`
The underlying matrix
• ### Constructor Detail

`public JamaDenseMatrix(Jama.Matrix matrix)`
Construct with matrix. The matrix is retained.
Parameters:
`matrix` - The matrix.

`public JamaDenseMatrix(double[][] values)`
Construct with 2d array of data.
Parameters:
`values` - The data.

```public JamaDenseMatrix(int rows,
int columns)```
Construct with given dimensions.
Parameters:
`rows` - number of rows.
`columns` - number of columns.
• ### Method Detail

• #### assertInvariant

```protected void assertInvariant()
throws IllegalArgumentException```
Throws:
`IllegalArgumentException`

```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
• #### 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 the elements with a constant value.
Parameters:
`constant` - the value to set the elements to.
• #### applyMultiplication

`public void applyMultiplication(double d)`
Multiply all elements by a constant.
Parameters:
`d` - the multiplication factor.
• #### getMatrix

`public Jama.Matrix getMatrix()`
Returns:
the wrapped JAMA matrix
• #### asArray

`public double[][] asArray()`
Description copied from class: `Matrix`
Get the matrix data as a 2D dense array
Overrides:
`asArray` in class `Matrix`
Returns:
the array representation
• #### newInstance

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