Class FloatVectorDataDense
java.lang.Object
org.djunits.value.storage.Storage<FloatVectorData>
org.djunits.value.vfloat.vector.data.FloatVectorData
org.djunits.value.vfloat.vector.data.FloatVectorDataDense
- All Implemented Interfaces:
Serializable,Cloneable
Stores dense data for a FloatVector and carries out basic operations.
Copyright (c) 2013-2025 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
- Author:
- Alexander Verbraeck, Peter Knoppers
- See Also:
-
Field Summary
Fields inherited from class org.djunits.value.vfloat.vector.data.FloatVectorData
vectorSI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal FloatVectorDataDenseassign(FloatFunction floatFunction) Apply an operation to each cell.final FloatVectorDataDenseassign(FloatFunction2 floatFunction2, FloatVectorData right) Apply a binary operation on a cell by cell basis.final intCompute and return the number of non-zero cells in this indexed value.final FloatVectorDataDensecopy()Create and return a deep copy of the data.final FloatVectorDatadivide(FloatVectorData right) Divide two vectors on a cell-by-cell basis.final float[]Create and return a dense copy of the data.final floatgetSI(int index) Retrieve the SI value of one element of this data.final FloatVectorDataDenseminus(FloatVectorData right) Subtract two vectors on a cell-by-cell basis.final FloatVectorDataDenseplus(FloatVectorData right) Add two vectors on a cell-by-cell basis.final voidsetSI(int index, float valueSI) Sets a value at the index in the vector.final intsize()Retrieve the size of the vector.final FloatVectorDatatimes(FloatVectorData right) Multiply two vector on a cell-by-cell basis.final FloatVectorDataDensetoDense()Return the densely stored equivalent of this data.final FloatVectorDataSparsetoSparse()Return the sparsely stored equivalent of this data.Methods inherited from class org.djunits.value.vfloat.vector.data.FloatVectorData
checkSizes, compareDenseVectorWithSparseVector, decrementBy, divideBy, equals, hashCode, incrementBy, instantiate, instantiate, instantiate, instantiate, multiplyBy, toString, zSumMethods inherited from class org.djunits.value.storage.Storage
getStorageType, isDense, isSparse
-
Constructor Details
-
FloatVectorDataDense
public FloatVectorDataDense(float[] vectorSI) Create a vector with dense data.- Parameters:
vectorSI- the data to store
-
-
Method Details
-
cardinality
public final int cardinality()Description copied from class:StorageCompute and return the number of non-zero cells in this indexed value.- Specified by:
cardinalityin classStorage<FloatVectorData>- Returns:
- the number of non-zero cells
-
assign
Description copied from class:FloatVectorDataApply an operation to each cell.- Specified by:
assignin classFloatVectorData- Parameters:
floatFunction- the operation to apply- Returns:
- this (modified) float vector data object
-
assign
Description copied from class:FloatVectorDataApply a binary operation on a cell by cell basis.- Specified by:
assignin classFloatVectorData- Parameters:
floatFunction2- the binary operation to applyright- the right operand for the binary operation- Returns:
- this (modified) float vector data object
-
toDense
Description copied from class:FloatVectorDataReturn the densely stored equivalent of this data.- Specified by:
toDensein classFloatVectorData- Returns:
- the dense transformation of this data
-
toSparse
Description copied from class:FloatVectorDataReturn the sparsely stored equivalent of this data.- Specified by:
toSparsein classFloatVectorData- Returns:
- the sparse transformation of this data
-
size
public final int size()Description copied from class:FloatVectorDataRetrieve the size of the vector.- Specified by:
sizein classFloatVectorData- Returns:
- the size of the vector
-
getSI
public final float getSI(int index) Description copied from class:FloatVectorDataRetrieve the SI value of one element of this data.- Specified by:
getSIin classFloatVectorData- Parameters:
index- the index to get the value for- Returns:
- the value at the index
-
setSI
public final void setSI(int index, float valueSI) Description copied from class:FloatVectorDataSets a value at the index in the vector.- Specified by:
setSIin classFloatVectorData- Parameters:
index- the index to set the value forvalueSI- the value at the index
-
getDenseVectorSI
public final float[] getDenseVectorSI()Description copied from class:FloatVectorDataCreate and return a dense copy of the data.- Specified by:
getDenseVectorSIin classFloatVectorData- Returns:
- a safe copy of VectorSI
-
copy
Description copied from class:StorageCreate and return a deep copy of the data.- Specified by:
copyin classStorage<FloatVectorData>- Returns:
- a deep copy of the data
-
plus
Description copied from class:FloatVectorDataAdd two vectors on a cell-by-cell basis. If both vectors are sparse, a sparse vector is returned, otherwise a dense vector is returned.- Specified by:
plusin classFloatVectorData- Parameters:
right- the other data object to add- Returns:
- the sum of this data object and the other data object
-
minus
Description copied from class:FloatVectorDataSubtract two vectors on a cell-by-cell basis. If both vectors are sparse, a sparse vector is returned, otherwise a dense vector is returned.- Specified by:
minusin classFloatVectorData- Parameters:
right- the other data object to subtract- Returns:
- the difference of this data object and the other data object
-
times
Description copied from class:FloatVectorDataMultiply two vector on a cell-by-cell basis. If both vectors are dense, a dense vector is returned, otherwise a sparse vector is returned.- Specified by:
timesin classFloatVectorData- Parameters:
right- the other data object to multiply with- Returns:
- a new double vector data store holding the result of the multiplications
-
divide
Description copied from class:FloatVectorDataDivide two vectors on a cell-by-cell basis. If this vector is sparse andrightis dense, a sparse vector is returned, otherwise a dense vector is returned.- Specified by:
dividein classFloatVectorData- Parameters:
right- the other data object to divide by- Returns:
- the ratios of the values of this data object and the other data object
-