public class DoubleMatrixDataSparse extends DoubleMatrixData
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 |
---|
DoubleMatrixDataSparse(double[][] dataSI)
Create a vector with sparse data.
|
DoubleMatrixDataSparse(double[] denseSI,
int rows,
int cols)
Create a vector with sparse data from an internal vector with dense data.
|
DoubleMatrixDataSparse(double[] matrixSI,
long[] indices,
int length,
int rows,
int cols)
Create a vector with sparse data.
|
Modifier and Type | Method and Description |
---|---|
DoubleMatrixDataSparse |
copy() |
void |
decrementBy(DoubleMatrixData right)
Subtract a matrix from this matrix on a cell-by-cell basis.
|
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) |
double[][] |
getDenseMatrixSI() |
double |
getSI(int row,
int col) |
int |
hashCode() |
void |
incrementBy(DoubleMatrixData right)
Add a matrix to this matrix on a cell-by-cell basis.
|
static DoubleMatrixDataSparse |
instantiate(double[][] valuesSI)
Instantiate a DoubleMatrixDataSparse from an array.
|
void |
multiplyBy(DoubleMatrixData right)
Multiply a matrix with the values of another matrix on a cell-by-cell basis.
|
void |
setSI(int row,
int col,
double valueSI)
Sets a value at the [row, col] point in the matrix.
|
DoubleMatrixDataDense |
toDense() |
cardinality, cols, decrementBy, divide, divideBy, getStorageType, incrementBy, instantiate, instantiate, isDense, isSparse, minus, multiplyBy, plus, rows, times, toSparse, toString, zSum
public DoubleMatrixDataSparse(double[] 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 DoubleMatrixDataSparse(double[] 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 DoubleMatrixDataSparse(double[][] dataSI) throws ValueException
dataSI
- the data to storeValueException
- in case matrix is raggedpublic final DoubleMatrixDataDense toDense()
toDense
in class DoubleMatrixData
public final double getSI(int row, int col)
getSI
in class DoubleMatrixData
row
- the row number to get the value forcol
- the column number to get the value forpublic final void setSI(int row, int col, double valueSI)
setSI
in class DoubleMatrixData
row
- the row number to set the value forcol
- the column number to set the value forvalueSI
- the value at the indexpublic final double[][] getDenseMatrixSI()
getDenseMatrixSI
in class DoubleMatrixData
public final DoubleMatrixDataSparse copy()
copy
in class DoubleMatrixData
public static DoubleMatrixDataSparse instantiate(double[][] valuesSI) throws ValueException
valuesSI
- the (SI) values to storeValueException
- in case matrix is raggedpublic final void incrementBy(DoubleMatrixData right) throws ValueException
incrementBy
in class DoubleMatrixData
right
- the other data object to addValueException
- if matrices have different lengthspublic final void decrementBy(DoubleMatrixData right) throws ValueException
decrementBy
in class DoubleMatrixData
right
- the other data object to subtractValueException
- if matrices have different lengthspublic final void multiplyBy(DoubleMatrixData right) throws ValueException
multiplyBy
in class DoubleMatrixData
right
- the other data object to multiply withValueException
- if matrices have different lengthspublic final void divideBy(DoubleMatrixData right) throws ValueException
divideBy
in class DoubleMatrixData
right
- the other data object to divide byValueException
- if matrices have different lengthspublic int hashCode()
hashCode
in class DoubleMatrixData
public boolean equals(Object obj)
equals
in class DoubleMatrixData
Copyright © 2015–2018 Delft University of Technology. All rights reserved.