abstract class FloatVectorData extends Object
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.
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
- the data type.public static FloatVectorData instantiate(float[] values, Scale scale, StorageType storageType) throws ValueException
values
- the (SI) values to storescale
- the scale of the unit to use for conversion to SIstorageType
- 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
- the values to storescale
- the scale of the unit to use for conversion to SIstorageType
- the data type to useValueException
- when list is null, or storageType is nullpublic static FloatVectorData instantiate(FloatScalarInterface[] values, StorageType storageType) throws ValueException
values
- the values to storestorageType
- 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
- the FloatScalar values to storestorageType
- 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
- the FloatScalar values to storelength
- the length of the vector to pad with 0 after last entry in mapstorageType
- 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
- the FloatScalar values to storelength
- the length of the vector to pad with 0 after last entry in mapscale
- the scale of the unit to use for conversion to SIstorageType
- 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
- the index to get the value forpublic abstract void setSI(int index, float valueSI)
index
- the index to set the value forvalueSI
- 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
- the other data object to addValueException
- if vectors have different lengthspublic abstract void incrementBy(FloatVectorData right) throws ValueException
right
- the other data object to addValueException
- if vectors have different lengthspublic void incrementBy(float valueSI)
valueSI
- the value to addpublic FloatVectorData minus(FloatVectorData right) throws ValueException
right
- the other data object to subtractValueException
- if vectors have different lengthspublic abstract void decrementBy(FloatVectorData right) throws ValueException
right
- the other data object to subtractValueException
- if vectors have different lengthspublic void decrementBy(float valueSI)
valueSI
- the value to subtractpublic FloatVectorData times(FloatVectorData right) throws ValueException
right
- the other data object to multiply withValueException
- if vectors have different lengthspublic abstract void multiplyBy(FloatVectorData right) throws ValueException
right
- the other data object to multiply withValueException
- if vectors have different lengthspublic void multiplyBy(float valueSI)
valueSI
- the value to multiply withpublic FloatVectorData divide(FloatVectorData right) throws ValueException
right
- the other data object to divide byValueException
- if vectors have different lengthspublic abstract void divideBy(FloatVectorData right) throws ValueException
right
- the other data object to divide byValueException
- if vectors have different lengthspublic void divideBy(float valueSI)
valueSI
- the value to multiply withCopyright © 2015–2018 Delft University of Technology. All rights reserved.