public class FloatMatrixDataSparse extends FloatMatrixData
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
cols, matrixSI, rows
Constructor and Description |
---|
FloatMatrixDataSparse(float[][] dataSI)
Create a vector with sparse data.
|
FloatMatrixDataSparse(float[] denseSI,
int rows,
int cols)
Create a vector with sparse data from an internal vector with dense data.
|
FloatMatrixDataSparse(float[] matrixSI,
long[] indices,
int length,
int rows,
int cols)
Create a vector with sparse data.
|
Modifier and Type | Method and Description |
---|---|
FloatMatrixDataSparse |
copy() |
void |
decrementBy(FloatMatrixData right)
Subtract a matrix from this matrix on a cell-by-cell basis.
|
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) |
float[][] |
getDenseMatrixSI() |
double[][] |
getDoubleDenseMatrixSI() |
float |
getSI(int row,
int col) |
int |
hashCode() |
void |
incrementBy(FloatMatrixData right)
Add a matrix to this matrix on a cell-by-cell basis.
|
static FloatMatrixDataSparse |
instantiate(float[][] valuesSI)
Instantiate a FloatMatrixDataSparse from an array.
|
void |
multiplyBy(FloatMatrixData right)
Multiply a matrix with the values of another matrix on a cell-by-cell basis.
|
void |
setSI(int row,
int col,
float valueSI)
Sets a value at the [row, col] point in the matrix.
|
FloatMatrixDataDense |
toDense() |
cardinality, cols, decrementBy, divide, divideBy, getStorageType, incrementBy, instantiate, instantiate, isDense, isSparse, minus, multiplyBy, plus, rows, times, toSparse, toString, zSum
public FloatMatrixDataSparse(float[] matrixSI, long[] indices, int length, int rows, int cols)
matrixSI
- the data to storeindices
- the index values of the Matrix, with index = row * cols + collength
- the length of the vector (padded with 0 after highest index in indices)rows
- the number of rowscols
- the number of columnspublic FloatMatrixDataSparse(float[] denseSI, int rows, int cols) throws ValueException
denseSI
- the dense data to storerows
- the number of rowscols
- the number of columnsValueException
- in case size is incorrectpublic FloatMatrixDataSparse(float[][] dataSI) throws ValueException
dataSI
- the data to storeValueException
- in case matrix is raggedpublic final FloatMatrixDataDense toDense()
toDense
in class FloatMatrixData
public final float getSI(int row, int col)
getSI
in class FloatMatrixData
row
- the row number to get the value forcol
- the column number to get the value forpublic final void setSI(int row, int col, float valueSI)
setSI
in class FloatMatrixData
row
- the row number to set the value forcol
- the column number to set the value forvalueSI
- the value at the indexpublic final float[][] getDenseMatrixSI()
getDenseMatrixSI
in class FloatMatrixData
public final double[][] getDoubleDenseMatrixSI()
getDoubleDenseMatrixSI
in class FloatMatrixData
public final FloatMatrixDataSparse copy()
copy
in class FloatMatrixData
public static FloatMatrixDataSparse instantiate(float[][] valuesSI) throws ValueException
valuesSI
- the (SI) values to storeValueException
- in case matrix is raggedpublic final void incrementBy(FloatMatrixData right) throws ValueException
incrementBy
in class FloatMatrixData
right
- the other data object to addValueException
- if matrices have different lengthspublic final void decrementBy(FloatMatrixData right) throws ValueException
decrementBy
in class FloatMatrixData
right
- the other data object to subtractValueException
- if matrices have different lengthspublic final void multiplyBy(FloatMatrixData right) throws ValueException
multiplyBy
in class FloatMatrixData
right
- the other data object to multiply withValueException
- if matrices have different lengthspublic final void divideBy(FloatMatrixData right) throws ValueException
divideBy
in class FloatMatrixData
right
- the other data object to divide byValueException
- if matrices have different lengthspublic int hashCode()
hashCode
in class FloatMatrixData
public boolean equals(Object obj)
equals
in class FloatMatrixData
Copyright © 2015–2018 Delft University of Technology. All rights reserved.