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