U - the unitT - the typepublic abstract class AbstractFloatMatrix<U extends Unit<U>,T extends AbstractFloatMatrix<U,T>> extends AbstractValue<U> implements FloatMatrixInterface<U>
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
| Modifier and Type | Field and Description |
|---|---|
protected FloatMatrixData |
data
The stored data as an object, can be sparse or dense.
|
| Constructor and Description |
|---|
AbstractFloatMatrix(U unit,
FloatMatrixData data)
Construct a new FloatMatrix.
|
| Modifier and Type | Method and Description |
|---|---|
int |
cardinality()
Count the number of cells that have a non-zero value (ignores tolerance).
|
protected void |
checkIndex(int row,
int column)
Check that provided row and column indices are valid.
|
protected void |
checkSize(AbstractFloatMatrixRel<?,?,?,?> other)
Centralized size equality check.
|
protected void |
checkSize(float[][] other)
Centralized size equality check.
|
int |
columns()
Retrieve the number of columns of the matrix.
|
float |
determinant()
Compute the determinant of the matrix.
|
protected static float[][] |
ensureRectangularAndNonEmpty(float[][] values)
Check that a 2D array of float is not null and rectangular; i.e.
|
boolean |
equals(Object obj) |
protected FloatMatrixData |
getData() |
float |
getInUnit(int row,
int column)
Retrieve the value stored at a specified row and column in the original unit.
|
float |
getInUnit(int row,
int column,
U targetUnit)
Retrieve the value stored at a specified row and column converted into a specified unit.
|
float |
getSI(int row,
int column)
Retrieve the value stored at a specified row and column in the standard SI unit.
|
StorageType |
getStorageType()
Return the StorageType (DENSE, SPARSE, etc.) for the stored Matrix.
|
float[][] |
getValuesInUnit()
Create a dense float[][] array filled with the values in the original unit.
|
float[][] |
getValuesInUnit(U targetUnit)
Create a dense float[][] array filled with the values converted into a specified unit.
|
float[][] |
getValuesSI()
Create a dense float[][] array filled with the values in the standard SI unit.
|
int |
hashCode() |
int |
rows()
Retrieve the number of rows of the matrix.
|
String |
toString() |
String |
toString(boolean verbose,
boolean withUnit)
Print this FloatMatrix with optional type and unit information.
|
String |
toString(U displayUnit)
Print this FloatMatrix with the values expressed in the specified unit.
|
String |
toString(U displayUnit,
boolean verbose,
boolean withUnit)
Print this FloatMatrix with the values expressed in the specified unit.
|
float |
zSum()
Compute the sum of all values of this matrix.
|
expressAsSIUnit, expressAsSpecifiedUnit, getUnit, isAbsolute, isRelative, setDisplayUnitclone, finalize, getClass, notify, notifyAll, wait, wait, waitget, toDense, toSparseprotected FloatMatrixData data
AbstractFloatMatrix(U unit, FloatMatrixData data)
unit - U; the unitdata - FloatMatrixData; an internal data objectprotected final FloatMatrixData getData()
public final StorageType getStorageType()
public final float[][] getValuesSI()
getValuesSI in interface FloatMatrixInterface<U extends Unit<U>>public final float[][] getValuesInUnit()
getValuesInUnit in interface FloatMatrixInterface<U extends Unit<U>>public final float[][] getValuesInUnit(U targetUnit)
getValuesInUnit in interface FloatMatrixInterface<U extends Unit<U>>targetUnit - U; the unit into which the values are converted for usepublic final int rows()
rows in interface FloatMatrixInterface<U extends Unit<U>>public final int columns()
columns in interface FloatMatrixInterface<U extends Unit<U>>public final float getSI(int row,
int column)
throws ValueException
getSI in interface FloatMatrixInterface<U extends Unit<U>>row - int; row of the value to retrievecolumn - int; column of the value to retrieveValueException - when row or column out of range (row < 0 or row >= rows() or column < 0 or column >=
columns())public final float getInUnit(int row,
int column)
throws ValueException
getInUnit in interface FloatMatrixInterface<U extends Unit<U>>row - int; row of the value to retrievecolumn - int; column of the value to retrieveValueException - when row or column out of range (row < 0 or row >= rows() or column < 0 or column >=
columns())public final float getInUnit(int row,
int column,
U targetUnit)
throws ValueException
getInUnit in interface FloatMatrixInterface<U extends Unit<U>>row - int; row of the value to retrievecolumn - int; column of the value to retrievetargetUnit - U; the unit for the resultValueException - when row or column out of range (row < 0 or row >= rows() or column < 0 or column >=
columns())public final float zSum()
zSum in interface FloatMatrixInterface<U extends Unit<U>>public final int cardinality()
cardinality in interface FloatMatrixInterface<U extends Unit<U>>public final String toString()
public final String toString(U displayUnit)
toString in interface FloatMatrixInterface<U extends Unit<U>>displayUnit - U; the unit into which the values are converted for displaypublic final String toString(boolean verbose, boolean withUnit)
toString in interface FloatMatrixInterface<U extends Unit<U>>verbose - boolean; if true; include type info; if false; exclude type infowithUnit - boolean; if true; include the unit; of false; exclude the unitpublic final String toString(U displayUnit, boolean verbose, boolean withUnit)
toString in interface FloatMatrixInterface<U extends Unit<U>>displayUnit - U; the unit into which the values are converted for displayverbose - boolean; if true; include type info; if false; exclude type infowithUnit - boolean; if true; include the unit; of false; exclude the unitprotected static float[][] ensureRectangularAndNonEmpty(float[][] values)
throws ValueException
values - float[][]; the 2D array to checkValueException - when not all rows have the same lengthprotected final void checkSize(AbstractFloatMatrixRel<?,?,?,?> other) throws ValueException
other - AbstractFloatMatrixRel<?, ?, ?, ?>; other FloatMatrixValueException - when other is null, or matrices have unequal sizeprotected final void checkSize(float[][] other)
throws ValueException
other - float[][]; array of floatValueException - when matrices have unequal sizeprotected final void checkIndex(int row,
int column)
throws ValueException
row - int; the row value to checkcolumn - int; the column value to checkValueException - when row or column is invalidpublic final float determinant()
throws ValueException
determinant in interface FloatMatrixInterface<U extends Unit<U>>ValueException - when matrix is neither sparse, nor dense, or not squareCopyright © 2015–2019 Delft University of Technology. All rights reserved.