abstract class DoubleVectorData extends Object implements Serializable
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 static int |
PARALLEL_THRESHOLD
threshold to do parallel execution.
|
protected double[] |
vectorSI
the internal storage of the Vector; can be sparse or dense.
|
Constructor and Description |
---|
DoubleVectorData(StorageType storageType) |
Modifier and Type | Method and Description |
---|---|
int |
cardinality() |
abstract DoubleVectorData |
copy() |
void |
decrementBy(double valueSI)
Subtract a number from this vector on a cell-by-cell basis.
|
abstract void |
decrementBy(DoubleVectorData right)
Subtract a vector from this vector on a cell-by-cell basis.
|
DoubleVectorData |
divide(DoubleVectorData right)
Divide two vectors on a cell-by-cell basis.
|
void |
divideBy(double valueSI)
Divide the values of this vector by a number on a cell-by-cell basis.
|
abstract void |
divideBy(DoubleVectorData right)
Divide the values of a vector by the values of another vector on a cell-by-cell basis.
|
boolean |
equals(Object obj) |
abstract double[] |
getDenseVectorSI() |
abstract double |
getSI(int index) |
StorageType |
getStorageType()
Return the StorageType (DENSE, SPARSE, etc.) for the stored Vector.
|
int |
hashCode() |
void |
incrementBy(double valueSI)
Add a number to this vector on a cell-by-cell basis.
|
abstract void |
incrementBy(DoubleVectorData right)
Add a vector to this vector on a cell-by-cell basis.
|
static DoubleVectorData |
instantiate(double[] values,
Scale scale,
StorageType storageType)
Instantiate a DoubleVectorData with the right data type.
|
static DoubleVectorData |
instantiate(DoubleScalarInterface[] values,
StorageType storageType)
Instantiate a DoubleVectorData with the right data type.
|
static DoubleVectorData |
instantiate(List<Double> values,
Scale scale,
StorageType storageType)
Instantiate a DoubleVectorData with the right data type.
|
static DoubleVectorData |
instantiate(SortedMap<Integer,Double> values,
int length,
Scale scale,
StorageType storageType)
Instantiate a DoubleVectorData with the right data type.
|
static DoubleVectorData |
instantiateLD(List<? extends DoubleScalarInterface> values,
StorageType storageType)
Instantiate a DoubleVectorData with the right data type.
|
static <S extends DoubleScalarInterface> |
instantiateMD(SortedMap<Integer,S> values,
int length,
StorageType storageType)
Instantiate a DoubleVectorData with the right data type.
|
boolean |
isDense() |
boolean |
isSparse() |
DoubleVectorData |
minus(DoubleVectorData right)
Subtract two vectors on a cell-by-cell basis.
|
void |
multiplyBy(double valueSI)
Multiply the values of this vector with a number on a cell-by-cell basis.
|
abstract void |
multiplyBy(DoubleVectorData right)
Multiply a vector with the values of another vector on a cell-by-cell basis.
|
DoubleVectorData |
plus(DoubleVectorData right)
Add two vectors on a cell-by-cell basis.
|
abstract void |
setSI(int index,
double valueSI)
Sets a value at the index in the vector.
|
abstract int |
size() |
DoubleVectorData |
times(DoubleVectorData right)
Multiply two vector on a cell-by-cell basis.
|
DoubleVectorDataDense |
toDense() |
DoubleVectorDataSparse |
toSparse() |
String |
toString() |
double |
zSum() |
protected double[] vectorSI
protected static final int PARALLEL_THRESHOLD
DoubleVectorData(StorageType storageType)
storageType
- StorageType; the data type.public static DoubleVectorData 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 DoubleVectorData instantiate(List<Double> values, Scale scale, StorageType storageType) throws ValueException
values
- List<Double>; the values to storescale
- Scale; the scale of the unit to use for conversion to SIstorageType
- StorageType; the data type to useValueException
- when list is null, or storageType is nullpublic static DoubleVectorData 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 static DoubleVectorData instantiateLD(List<? extends DoubleScalarInterface> values, StorageType storageType) throws ValueException
values
- List<? extends DoubleScalarInterface>; the DoubleScalar values to storestorageType
- StorageType; the data type to useValueException
- when values is null, or storageType is nullpublic static <S extends DoubleScalarInterface> DoubleVectorData instantiateMD(SortedMap<Integer,S> values, int length, StorageType storageType) throws ValueException
S
- the scalar type to usevalues
- SortedMap<Integer,S>; the DoubleScalar values to storelength
- int; the length of the vector to pad with 0 after last entry in mapstorageType
- StorageType; the data type to useValueException
- when values is null, or storageType is nullpublic static DoubleVectorData instantiate(SortedMap<Integer,Double> values, int length, Scale scale, StorageType storageType) throws ValueException
values
- SortedMap<Integer,Double>; the DoubleScalar values to storelength
- int; the length of the vector to pad with 0 after last entry in mapscale
- Scale; the scale of the unit to use for conversion to SIstorageType
- StorageType; the data type to useValueException
- when values is null, or storageType is nullpublic final StorageType getStorageType()
public abstract int size()
public boolean isSparse()
public DoubleVectorDataSparse toSparse()
public boolean isDense()
public DoubleVectorDataDense toDense()
public abstract double getSI(int index)
index
- int; the index to get the value forpublic abstract void setSI(int index, double valueSI)
index
- int; the index to set the value forvalueSI
- double; the value at the indexpublic final int cardinality()
public final double zSum()
public abstract DoubleVectorData copy()
public abstract double[] getDenseVectorSI()
public DoubleVectorData plus(DoubleVectorData right) throws ValueException
right
- DoubleVectorData; the other data object to addValueException
- if vectors have different lengthspublic abstract void incrementBy(DoubleVectorData right) throws ValueException
right
- DoubleVectorData; the other data object to addValueException
- if vectors have different lengthspublic void incrementBy(double valueSI)
valueSI
- double; the value to addpublic DoubleVectorData minus(DoubleVectorData right) throws ValueException
right
- DoubleVectorData; the other data object to subtractValueException
- if vectors have different lengthspublic abstract void decrementBy(DoubleVectorData right) throws ValueException
right
- DoubleVectorData; the other data object to subtractValueException
- if vectors have different lengthspublic void decrementBy(double valueSI)
valueSI
- double; the value to subtractpublic DoubleVectorData times(DoubleVectorData right) throws ValueException
right
- DoubleVectorData; the other data object to multiply withValueException
- if vectors have different lengthspublic abstract void multiplyBy(DoubleVectorData right) throws ValueException
right
- DoubleVectorData; the other data object to multiply withValueException
- if vectors have different lengthspublic void multiplyBy(double valueSI)
valueSI
- double; the value to multiply withpublic DoubleVectorData divide(DoubleVectorData right) throws ValueException
right
- DoubleVectorData; the other data object to divide byValueException
- if vectors have different lengthspublic abstract void divideBy(DoubleVectorData right) throws ValueException
right
- DoubleVectorData; the other data object to divide byValueException
- if vectors have different lengthspublic void divideBy(double valueSI)
valueSI
- double; the value to multiply withCopyright © 2015–2019 Delft University of Technology. All rights reserved.