abstract class FloatMatrixData extends Object
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Field and Description |
---|---|
protected int |
cols
the number of columns of the matrix.
|
protected float[] |
matrixSI
the internal storage of the Matrix; can be sparse or dense.
|
protected int |
rows
the number of rows of the matrix.
|
Constructor and Description |
---|
FloatMatrixData(StorageType storageType) |
Modifier and Type | Method and Description |
---|---|
int |
cardinality() |
int |
cols() |
abstract FloatMatrixData |
copy() |
void |
decrementBy(float valueSI)
Subtract a number from this matrix on a cell-by-cell basis.
|
abstract void |
decrementBy(FloatMatrixData right)
Subtract a matrix from this matrix on a cell-by-cell basis.
|
FloatMatrixData |
divide(FloatMatrixData right)
Divide two matrices on a cell-by-cell basis.
|
void |
divideBy(float valueSI)
Divide the values of this matrix by a number on a cell-by-cell basis.
|
abstract void |
divideBy(FloatMatrixData right)
Divide the values of a matrix by the values of another matrix on a cell-by-cell basis.
|
boolean |
equals(Object obj) |
abstract float[][] |
getDenseMatrixSI() |
abstract double[][] |
getDoubleDenseMatrixSI() |
abstract float |
getSI(int row,
int col) |
StorageType |
getStorageType()
Return the StorageType (DENSE, SPARSE, etc.) for the stored Matrix.
|
int |
hashCode() |
void |
incrementBy(float valueSI)
Add a number to this matrix on a cell-by-cell basis.
|
abstract void |
incrementBy(FloatMatrixData right)
Add a matrix to this matrix on a cell-by-cell basis.
|
static FloatMatrixData |
instantiate(float[][] values,
Scale scale,
StorageType storageType)
Instantiate a FloatMatrixData with the right data type.
|
static FloatMatrixData |
instantiate(FloatScalarInterface[][] values,
StorageType storageType)
Instantiate a FloatMatrixData with the right data type.
|
boolean |
isDense() |
boolean |
isSparse() |
FloatMatrixData |
minus(FloatMatrixData right)
Subtract two matrices on a cell-by-cell basis.
|
void |
multiplyBy(float valueSI)
Multiply the values of this matrix with a number on a cell-by-cell basis.
|
abstract void |
multiplyBy(FloatMatrixData right)
Multiply a matrix with the values of another matrix on a cell-by-cell basis.
|
FloatMatrixData |
plus(FloatMatrixData right)
Add two matrices on a cell-by-cell basis.
|
int |
rows() |
abstract void |
setSI(int row,
int col,
float valueSI)
Sets a value at the [row, col] point in the matrix.
|
FloatMatrixData |
times(FloatMatrixData right)
Multiply two matrix on a cell-by-cell basis.
|
FloatMatrixDataDense |
toDense() |
FloatMatrixDataSparse |
toSparse() |
String |
toString() |
float |
zSum() |
protected float[] matrixSI
protected int rows
protected int cols
FloatMatrixData(StorageType storageType)
storageType
- StorageType; the data type.public static FloatMatrixData instantiate(float[][] values, Scale scale, StorageType storageType) throws ValueException
values
- float[][]; the (SI) values to storescale
- Scale; the scale of the unit to use for conversion to SIstorageType
- StorageType; the data type to useValueException
- when values are null, or storageType is nullpublic static FloatMatrixData instantiate(FloatScalarInterface[][] values, StorageType storageType) throws ValueException
values
- FloatScalarInterface[][]; the values to storestorageType
- StorageType; the data type to useValueException
- when values is null, or storageType is nullpublic final StorageType getStorageType()
public int rows()
public int cols()
public boolean isSparse()
public FloatMatrixDataSparse toSparse()
public boolean isDense()
public FloatMatrixDataDense toDense()
public abstract float getSI(int row, int col)
row
- int; the row number to get the value forcol
- int; the column number to get the value forpublic abstract void setSI(int row, int col, float valueSI)
row
- int; the row number to set the value forcol
- int; the column number to set the value forvalueSI
- float; the value at the indexpublic final int cardinality()
public final float zSum()
public abstract FloatMatrixData copy()
public abstract float[][] getDenseMatrixSI()
public abstract double[][] getDoubleDenseMatrixSI()
public FloatMatrixData plus(FloatMatrixData right) throws ValueException
right
- FloatMatrixData; the other data object to addValueException
- if matrices have different lengthspublic abstract void incrementBy(FloatMatrixData right) throws ValueException
right
- FloatMatrixData; the other data object to addValueException
- if matrices have different lengthspublic void incrementBy(float valueSI)
valueSI
- float; the value to addpublic FloatMatrixData minus(FloatMatrixData right) throws ValueException
right
- FloatMatrixData; the other data object to subtractValueException
- if matrices have different lengthspublic abstract void decrementBy(FloatMatrixData right) throws ValueException
right
- FloatMatrixData; the other data object to subtractValueException
- if matrices have different lengthspublic void decrementBy(float valueSI)
valueSI
- float; the value to subtractpublic FloatMatrixData times(FloatMatrixData right) throws ValueException
right
- FloatMatrixData; the other data object to multiply withValueException
- if matrices have different lengthspublic abstract void multiplyBy(FloatMatrixData right) throws ValueException
right
- FloatMatrixData; the other data object to multiply withValueException
- if matrices have different lengthspublic void multiplyBy(float valueSI)
valueSI
- float; the value to multiply withpublic FloatMatrixData divide(FloatMatrixData right) throws ValueException
right
- FloatMatrixData; the other data object to divide byValueException
- if matrices have different lengthspublic abstract void divideBy(FloatMatrixData right) throws ValueException
right
- FloatMatrixData; the other data object to divide byValueException
- if matrices have different lengthspublic void divideBy(float valueSI)
valueSI
- float; the value to multiply withCopyright © 2015–2019 Delft University of Technology. All rights reserved.