abstract class DoubleMatrixData 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 double[] |
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 |
---|
DoubleMatrixData(StorageType storageType) |
Modifier and Type | Method and Description |
---|---|
int |
cardinality() |
int |
cols() |
abstract DoubleMatrixData |
copy() |
void |
decrementBy(double valueSI)
Subtract a number from this matrix on a cell-by-cell basis.
|
abstract void |
decrementBy(DoubleMatrixData right)
Subtract a matrix from this matrix on a cell-by-cell basis.
|
DoubleMatrixData |
divide(DoubleMatrixData right)
Divide two matrices on a cell-by-cell basis.
|
void |
divideBy(double valueSI)
Divide the values of this matrix by a number on a cell-by-cell basis.
|
abstract void |
divideBy(DoubleMatrixData right)
Divide the values of a matrix by the values of another matrix on a cell-by-cell basis.
|
boolean |
equals(Object obj) |
abstract double[][] |
getDenseMatrixSI() |
abstract double |
getSI(int row,
int col) |
StorageType |
getStorageType()
Return the StorageType (DENSE, SPARSE, etc.) for the stored Matrix.
|
int |
hashCode() |
void |
incrementBy(double valueSI)
Add a number to this matrix on a cell-by-cell basis.
|
abstract void |
incrementBy(DoubleMatrixData right)
Add a matrix to this matrix on a cell-by-cell basis.
|
static DoubleMatrixData |
instantiate(double[][] values,
Scale scale,
StorageType storageType)
Instantiate a DoubleMatrixData with the right data type.
|
static DoubleMatrixData |
instantiate(DoubleScalarInterface[][] values,
StorageType storageType)
Instantiate a DoubleMatrixData with the right data type.
|
boolean |
isDense() |
boolean |
isSparse() |
DoubleMatrixData |
minus(DoubleMatrixData right)
Subtract two matrices on a cell-by-cell basis.
|
void |
multiplyBy(double valueSI)
Multiply the values of this matrix with a number on a cell-by-cell basis.
|
abstract void |
multiplyBy(DoubleMatrixData right)
Multiply a matrix with the values of another matrix on a cell-by-cell basis.
|
DoubleMatrixData |
plus(DoubleMatrixData right)
Add two matrices on a cell-by-cell basis.
|
int |
rows() |
abstract 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 matrix on a cell-by-cell basis.
|
DoubleMatrixDataDense |
toDense() |
DoubleMatrixDataSparse |
toSparse() |
String |
toString() |
double |
zSum() |
protected double[] matrixSI
protected int rows
protected int cols
DoubleMatrixData(StorageType storageType)
storageType
- StorageType; the data type.public static DoubleMatrixData instantiate(double[][] values, Scale scale, StorageType storageType) throws ValueException
values
- double[][]; 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 DoubleMatrixData instantiate(DoubleScalarInterface[][] values, StorageType storageType) throws ValueException
values
- DoubleScalarInterface[][]; 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 DoubleMatrixDataSparse toSparse()
public boolean isDense()
public DoubleMatrixDataDense toDense()
public abstract double 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, double valueSI)
row
- int; the row number to set the value forcol
- int; the column number to set the value forvalueSI
- double; the value at the indexpublic final int cardinality()
public final double zSum()
public abstract DoubleMatrixData copy()
public abstract double[][] getDenseMatrixSI()
public DoubleMatrixData plus(DoubleMatrixData right) throws ValueException
right
- DoubleMatrixData; the other data object to addValueException
- if matrices have different lengthspublic abstract void incrementBy(DoubleMatrixData right) throws ValueException
right
- DoubleMatrixData; the other data object to addValueException
- if matrices have different lengthspublic void incrementBy(double valueSI)
valueSI
- double; the value to addpublic DoubleMatrixData minus(DoubleMatrixData right) throws ValueException
right
- DoubleMatrixData; the other data object to subtractValueException
- if matrices have different lengthspublic abstract void decrementBy(DoubleMatrixData right) throws ValueException
right
- DoubleMatrixData; the other data object to subtractValueException
- if matrices have different lengthspublic void decrementBy(double valueSI)
valueSI
- double; the value to subtractpublic DoubleMatrixData times(DoubleMatrixData right) throws ValueException
right
- DoubleMatrixData; the other data object to multiply withValueException
- if matrices have different lengthspublic abstract void multiplyBy(DoubleMatrixData right) throws ValueException
right
- DoubleMatrixData; the other data object to multiply withValueException
- if matrices have different lengthspublic void multiplyBy(double valueSI)
valueSI
- double; the value to multiply withpublic DoubleMatrixData divide(DoubleMatrixData right) throws ValueException
right
- DoubleMatrixData; the other data object to divide byValueException
- if matrices have different lengthspublic abstract void divideBy(DoubleMatrixData right) throws ValueException
right
- DoubleMatrixData; the other data object to divide byValueException
- if matrices have different lengthspublic void divideBy(double valueSI)
valueSI
- double; the value to multiply withCopyright © 2015–2019 Delft University of Technology. All rights reserved.