Class DoubleVectorRel<U extends Unit<U>,S extends DoubleScalarRel<U,S>,RV extends DoubleVectorRel<U,S,RV>>
java.lang.Object
org.djunits.value.IndexedValue<U,S,V,D>
org.djunits.value.base.Vector<U,S,V,DoubleVectorData>
org.djunits.value.vdouble.vector.base.DoubleVector<U,S,RV>
org.djunits.value.vdouble.vector.base.DoubleVectorRel<U,S,RV>
- Type Parameters:
U- the unitS- the scalar type belonging to the vector typeRV- the relative vector type with this unit
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<S>,Relative<U,,RV> Value<U,RV>
- Direct Known Subclasses:
AbsorbedDoseVector,AccelerationVector,AmountOfSubstanceVector,AngularAccelerationVector,AngularVelocityVector,AreaVector,CatalyticActivityVector,DensityVector,DimensionlessVector,DoubleVectorRelWithAbs,ElectricalCapacitanceVector,ElectricalChargeVector,ElectricalConductanceVector,ElectricalCurrentVector,ElectricalInductanceVector,ElectricalPotentialVector,ElectricalResistanceVector,EnergyVector,EquivalentDoseVector,FlowMassVector,FlowVolumeVector,ForceVector,FrequencyVector,IlluminanceVector,LinearDensityVector,LuminousFluxVector,LuminousIntensityVector,MagneticFluxDensityVector,MagneticFluxVector,MassVector,MomentumVector,PowerVector,PressureVector,RadioActivityVector,SIVector,SolidAngleVector,SpeedVector,TorqueVector,VolumeVector
public abstract class DoubleVectorRel<U extends Unit<U>,S extends DoubleScalarRel<U,S>,RV extends DoubleVectorRel<U,S,RV>>
extends DoubleVector<U,S,RV>
implements Relative<U,RV>
AbstractMutableDoubleVectorRel.java.
Copyright (c) 2019-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
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.djunits.value.vdouble.vector.base.DoubleVector
DoubleVector.Itr -
Field Summary
Fields inherited from class org.djunits.value.vdouble.vector.base.DoubleVector
data -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDoubleVectorRel(DoubleVectorData data, U unit) Construct a new Relative Mutable DoubleVector. -
Method Summary
Modifier and TypeMethodDescriptiondecrementBy(RV decrement) Decrement all values of this vector by the decrement on a value by value basis.decrementBy(S decrement) Decrement all values of this vector by the decrement.divide(double divisor) Returns a new scalar/vector/matrix with value(s) divided by a factor.divide(float divisor) Returns a new scalar/vector/matrix with value(s) divided by a factor.final <UT extends Unit<UT>,ST extends DoubleScalarRel<UT, ST>, VT extends DoubleVectorRel<UT, ST, VT>>
SIVectordivide(VT rel) Divide this Relative value by a Relative value for a vector or matrix.divideBy(double divisor) Divide all values of this vector by the divisor.incrementBy(RV increment) Increment all values of this vector by the increment on a value by value basis.incrementBy(S increment) Increment all values of this vector by the increment.final RVSubtract a Relative value from this Relative value.multiplyBy(double multiplier) Multiply all values of this vector by the multiplier.final RVAdd a Relative value to this Relative value.times(double multiplier) Returns a new scalar/vector/matrix with value(s) multiplied by a factor.times(float multiplier) Returns a new scalar/vector/matrix with value(s) multiplied by a factor.final <UT extends Unit<UT>,ST extends DoubleScalarRel<UT, ST>, VT extends DoubleVectorRel<UT, ST, VT> & Relative<UT, VT>>
SIVectortimes(VT rel) Multiply a Relative value with this Relative value for a vector or matrix.final SzSum()Compute the sum of all SI values of this vector.Methods inherited from class org.djunits.value.vdouble.vector.base.DoubleVector
abs, assign, ceil, checkIndex, checkSize, equals, floor, get, getData, getInUnit, getInUnit, getScalars, getSI, getValuesInUnit, getValuesInUnit, getValuesSI, hashCode, instantiateScalarSI, instantiateVector, iterator, neg, rint, set, setData, setInUnit, setInUnit, setSI, size, toDense, toSparse, toString, toString, toString, toStringMethods inherited from class org.djunits.value.IndexedValue
cardinality, checkCopyOnWrite, clone, getDisplayUnit, getScalarClass, getStorageType, immutable, isCopyOnWrite, isDense, isMutable, isSparse, mutable, setCopyOnWrite, setDisplayUnit, setMutableMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.djunits.value.Value
isAbsolute, isRelative
-
Constructor Details
-
DoubleVectorRel
Construct a new Relative Mutable DoubleVector.- Parameters:
data- an internal data objectunit- the unit
-
-
Method Details
-
zSum
Compute the sum of all SI values of this vector.- Returns:
- the sum of all SI values of this vector with the same display unit as this vector
-
plus
Description copied from interface:RelativeAdd a Relative value to this Relative value. A new value is returned due to immutability.- Specified by:
plusin interfaceRelative<U extends Unit<U>,S extends DoubleScalarRel<U, S>> - Parameters:
rel- the value to add- Returns:
- the sum of this value and the operand as a new object
- Throws:
ValueRuntimeException
-
minus
Description copied from interface:RelativeSubtract a Relative value from this Relative value. A new value is returned due to immutability.- Specified by:
minusin interfaceRelative<U extends Unit<U>,S extends DoubleScalarRel<U, S>> - Parameters:
rel- the value to subtract- Returns:
- the difference of this value and the operand
- Throws:
ValueRuntimeException
-
incrementBy
Increment all values of this vector by the increment. This only works if the vector is mutable.- Parameters:
increment- the scalar by which to increment all values- Returns:
- this modified vector
- Throws:
ValueRuntimeException- in case this vector is immutable
-
incrementBy
Increment all values of this vector by the increment on a value by value basis. This only works if this vector is mutable.- Parameters:
increment- the vector that contains the values by which to increment the corresponding values- Returns:
- this modified vector
- Throws:
ValueRuntimeException- in case this vector is immutable, when the sizes of the vectors differ, orincrementis null
-
decrementBy
Decrement all values of this vector by the decrement. This only works if the vector is mutable.- Parameters:
decrement- the scalar by which to decrement all values- Returns:
- this modified vector
- Throws:
ValueRuntimeException- in case this vector is immutable
-
decrementBy
Decrement all values of this vector by the decrement on a value by value basis. This only works if this vector is mutable.- Parameters:
decrement- the vector that contains the values by which to decrement the corresponding values- Returns:
- this modified vector
- Throws:
ValueRuntimeException- in case this vector is immutable, when the sizes of the vectors differ, ordecrementis null
-
multiplyBy
Multiply all values of this vector by the multiplier. This only works if the vector is mutable.- Parameters:
multiplier- the factor by which to multiply all values- Returns:
- this modified vector
- Throws:
ValueRuntimeException- in case the vector is immutable
-
divideBy
Divide all values of this vector by the divisor. This only works if the vector is mutable.- Parameters:
divisor- the value by which to divide all values- Returns:
- this modified vector
- Throws:
ValueRuntimeException- in case the vector is immutable
-
times
public final <UT extends Unit<UT>,ST extends DoubleScalarRel<UT, SIVector timesST>, VT extends DoubleVectorRel<UT, ST, VT> & Relative<UT, VT>> (VT rel) throws ValueRuntimeException, UnitException Multiply a Relative value with this Relative value for a vector or matrix. The multiplication is done value by value and store the result in a new Relative value. If both operands are dense, the result is a dense vector or matrix, otherwise the result is a sparse vector or matrix.- Type Parameters:
UT- the unit type of the multiplierST- the scalar type of the multiplierVT- the vector type of the multiplier- Parameters:
rel- the right operand, which can be any vector type- Returns:
- the multiplication of this vector and the operand
- Throws:
ValueRuntimeException- in case this vector or matrix and the operand have a different sizeUnitException- on unit error
-
divide
public final <UT extends Unit<UT>,ST extends DoubleScalarRel<UT, SIVector divideST>, VT extends DoubleVectorRel<UT, ST, VT>> (VT rel) throws ValueRuntimeException, UnitException Divide this Relative value by a Relative value for a vector or matrix. The division is done value by value and store the result in a new Relative value. If both operands are dense, the result is a dense vector or matrix, otherwise the result is a sparse vector or matrix.- Type Parameters:
UT- the unit type of the multiplierST- the scalar type of the multiplierVT- the vector type of the multiplier- Parameters:
rel- the right operand, which can be any vector type- Returns:
- the division of this vector and the operand
- Throws:
ValueRuntimeException- in case this vector or matrix and the operand have a different sizeUnitException- on unit error
-
times
Description copied from interface:RelativeReturns a new scalar/vector/matrix with value(s) multiplied by a factor. -
divide
Description copied from interface:RelativeReturns a new scalar/vector/matrix with value(s) divided by a factor. -
times
Description copied from interface:RelativeReturns a new scalar/vector/matrix with value(s) multiplied by a factor. -
divide
Description copied from interface:RelativeReturns a new scalar/vector/matrix with value(s) divided by a factor.
-