U
- the unitR
- the vector typeMR
- the mutable vector typeS
- the scalar typeabstract class AbstractMutableDoubleVectorRel<U extends Unit<U>,R extends AbstractDoubleVectorRel<U,R,MR,S>,MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>,S extends AbstractDoubleScalarRel<U,S>> extends AbstractDoubleVectorRel<U,R,MR,S> implements MathFunctionsRel<MR>, DoubleMathFunctions<MR>, MutableDoubleVectorInterface<U>
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License.
$LastChangedDate: 2015-09-29 14:14:28 +0200 (Tue, 29 Sep 2015) $, @version $Revision: 73 $, by $Author: pknoppers $, initial
version Sep 5, 2015
AbstractDoubleVectorRel.Itr
data
Constructor and Description |
---|
AbstractMutableDoubleVectorRel(double[] values,
U unit,
StorageType storageType)
Construct a new Relative Mutable DoubleVector.
|
AbstractMutableDoubleVectorRel(DoubleVectorData data,
U unit)
Construct a new Relative Mutable DoubleVector.
|
AbstractMutableDoubleVectorRel(List<Double> values,
U unit,
StorageType storageType)
Construct a new Relative Mutable DoubleVector.
|
AbstractMutableDoubleVectorRel(List<S> values,
StorageType storageType)
Construct a new Relative Mutable DoubleVector.
|
AbstractMutableDoubleVectorRel(S[] values,
StorageType storageType)
Construct a new Relative Mutable DoubleVector.
|
AbstractMutableDoubleVectorRel(SortedMap<Integer,Double> values,
U unit,
int length,
StorageType storageType)
Construct a new Relative Mutable DoubleVector.
|
AbstractMutableDoubleVectorRel(SortedMap<Integer,S> values,
int length,
StorageType storageType)
Construct a new Relative Mutable DoubleVector.
|
Modifier and Type | Method and Description |
---|---|
MR |
abs()
Set the value(s) to their absolute value.
|
void |
assign(DoubleFunction doubleFunction)
Execute a function on a cell by cell basis.
|
MR |
ceil()
Set the value(s) to the smallest (closest to negative infinity) value(s) that are greater than or equal to the argument
and equal to a mathematical integer.
|
protected void |
checkCopyOnWrite()
Check the copyOnWrite flag and, if it is set, make a deep copy of the data and clear the flag.
|
MR |
copy()
Create a deep copy of this MutableDoubleVector.
|
MR |
decrementBy(double decrement)
Decrement the value by the supplied constant and return the changed vector.
|
MR |
decrementBy(R decrement)
Decrement the value by the supplied value and return the changed vector.
|
MR |
decrementBy(S decrement)
Decrement the value by the supplied value and return the changed vector.
|
MR |
divideBy(double factor)
Scale the value(s) by the inverse of a factor; i.e.
|
MR |
divideBy(R factors)
Divide the values in the vector by the supplied values and return the changed vector.
|
MR |
divideBy(S factor)
Divide the values in the vector by the supplied value and return the changed vector.
|
MR |
floor()
Set the value(s) to the largest (closest to positive infinity) value(s) that are less than or equal to the argument and
equal to a mathematical integer.
|
R |
immutable()
Create a immutable version of this MutableDoubleVector.
|
MR |
incrementBy(double increment)
Increment the value by the supplied constant and return the changed vector.
|
MR |
incrementBy(R increment)
Increment the value by the supplied value and return the changed vector.
|
MR |
incrementBy(S increment)
Increment the value by the supplied value and return the changed vector.
|
MR |
multiplyBy(double factor)
Scale the value(s) by a factor.
|
MR |
multiplyBy(R factors)
Multiply the values in the vector by the supplied values and return the changed vector.
|
MR |
multiplyBy(S factor)
Multiply the values in the vector by the supplied value and return the changed vector.
|
MR |
mutable()
Create a mutable version of this DoubleVector.
|
MR |
neg()
Set the value(s) to the minus value.
|
void |
normalize()
Normalize the vector, i.e.
|
MR |
rint()
Set the value(s) to the value(s) that are closest in value to the argument and equal to a mathematical integer.
|
MR |
round()
Set the value(s) to the closest long to the argument with ties rounding up.
|
void |
set(int index,
S value)
Replace the value at index by the supplied value which is in a compatible unit.
|
(package private) void |
setCopyOnWrite(boolean copyOnWrite)
Change the copyOnWrite flag.
|
void |
setInUnit(int index,
double value,
U valueUnit)
Replace the value at index by the supplied value which is expressed in a supplied (compatible) unit.
|
void |
setSI(int index,
double valueSI)
Replace the value at index by the supplied value which is expressed in the standard SI unit.
|
checkUnit, checkUnit, checkUnit, divide, get, instantiateMutableType, instantiateScalar, instantiateType, iterator, minus, plus, times
cardinality, checkIndex, checkSize, checkSize, equals, getData, getInUnit, getInUnit, getSI, getStorageType, getValuesInUnit, getValuesInUnit, getValuesSI, hashCode, size, toString, toString, toString, toString, zSum
expressAsSIUnit, expressAsSpecifiedUnit, getUnit, isAbsolute, isRelative, setDisplayUnit
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
DIV, MULT, POW
cardinality, get, getInUnit, getInUnit, getSI, getValuesInUnit, getValuesInUnit, getValuesSI, size, toDense, toSparse, toString, toString, toString, toString, zSum
forEach, spliterator
AbstractMutableDoubleVectorRel(double[] values, U unit, StorageType storageType) throws ValueException
values
- double[]; the values of the entries in the new Relative Mutable DoubleVectorunit
- U; the unit of the new Relative Mutable DoubleVectorstorageType
- the data type to use (e.g., DENSE or SPARSE)ValueException
- when values is nullAbstractMutableDoubleVectorRel(List<Double> values, U unit, StorageType storageType) throws ValueException
values
- List; the values of the entries in the new Relative Mutable DoubleVectorunit
- U; the unit of the new Relative Mutable DoubleVectorstorageType
- the data type to use (e.g., DENSE or SPARSE)ValueException
- when values is nullAbstractMutableDoubleVectorRel(S[] values, StorageType storageType) throws ValueException
values
- DoubleScalar.Rel<U>[]; the values of the entries in the new Relative Mutable DoubleVectorstorageType
- the data type to use (e.g., DENSE or SPARSE)ValueException
- when values has zero entriesAbstractMutableDoubleVectorRel(List<S> values, StorageType storageType) throws ValueException
values
- List; the values of the entries in the new Relative Mutable DoubleVectorstorageType
- the data type to use (e.g., DENSE or SPARSE)ValueException
- when values has zero entriesAbstractMutableDoubleVectorRel(SortedMap<Integer,S> values, int length, StorageType storageType) throws ValueException
values
- DoubleScalar.Rel<U>[]; the values of the entries in the new Relative Sparse Mutable DoubleVectorlength
- the size of the vectorstorageType
- the data type to use (e.g., DENSE or SPARSE)ValueException
- when values has zero entriesAbstractMutableDoubleVectorRel(SortedMap<Integer,Double> values, U unit, int length, StorageType storageType) throws ValueException
values
- Map; the map of indexes to values of the Relative Sparse Mutable DoubleVectorunit
- U; the unit of the new Relative Sparse Mutable DoubleVectorlength
- the size of the vectorstorageType
- the data type to use (e.g., DENSE or SPARSE)ValueException
- when values is nullAbstractMutableDoubleVectorRel(DoubleVectorData data, U unit)
data
- an internal data objectunit
- the unitfinal void setCopyOnWrite(boolean copyOnWrite)
copyOnWrite
- boolean; the new value for the copyOnWrite flagpublic final MR mutable()
mutable
in interface DoubleVectorInterface<U extends Unit<U>>
mutable
in class AbstractDoubleVectorRel<U extends Unit<U>,R extends AbstractDoubleVectorRel<U,R,MR,S>,MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>,S extends AbstractDoubleScalarRel<U,S>>
public R immutable()
immutable
in interface MutableDoubleVectorInterface<U extends Unit<U>>
public final MR copy()
public final MR incrementBy(R increment) throws ValueException
increment
- DoubleVector.Rel<U>; amount by which the value is incrementedValueException
- when the size of increment is not identical to the size of thispublic final MR incrementBy(S increment)
increment
- DoubleScalar.Rel<U>; amount by which the value is incrementedpublic final MR incrementBy(double increment)
increment
- amount by which the value is incrementedpublic final MR decrementBy(R decrement) throws ValueException
decrement
- DoubleVector.Rel<U>; amount by which the value is decrementedValueException
- when the size of increment is not identical to the size of thispublic final MR decrementBy(S decrement)
decrement
- DoubleScalar.Rel<U>; amount by which the value is decrementedpublic final MR decrementBy(double decrement)
decrement
- amount by which the value is decrementedpublic final MR multiplyBy(R factors) throws ValueException
factors
- DoubleVector.Rel<U>; amounts by which the value is multipliedValueException
- when the size of the factors is not identical to the size of thispublic final MR multiplyBy(S factor)
factor
- DoubleScalar.Rel<U>; amount by which the values in the vector are multipliedpublic final MR multiplyBy(double factor)
multiplyBy
in interface DoubleMathFunctions<MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>>
factor
- double; the multiplierpublic final MR divideBy(R factors) throws ValueException
factors
- DoubleVector.Rel<U>; amounts by which the value is dividedValueException
- when the size of the factors is not identical to the size of thispublic MR divideBy(double factor)
divideBy
in interface DoubleMathFunctions<MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>>
factor
- double; the divisorpublic final MR divideBy(S factor)
factor
- DoubleScalar.Rel<U>; amount by which the values in the vector are dividedpublic final void assign(DoubleFunction doubleFunction)
doubleFunction
- the function to applypublic final MR abs()
abs
in interface MathFunctionsRel<MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>>
public final MR ceil()
ceil
in interface MathFunctionsAbs<MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>>
public final MR floor()
floor
in interface MathFunctionsAbs<MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>>
public final MR neg()
neg
in interface MathFunctionsRel<MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>>
public final MR rint()
rint
in interface MathFunctionsAbs<MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>>
public final MR round()
round
in interface MathFunctionsAbs<MR extends AbstractMutableDoubleVectorRel<U,R,MR,S>>
protected final void checkCopyOnWrite()
public final void setSI(int index, double valueSI) throws ValueException
index
- int; index of the value to replacevalueSI
- double; the value to store (expressed in the standard SI unit)ValueException
- when index out of range (index < 0 or index >= size())public final void set(int index, S value) throws ValueException
index
- int; index of the value to replacevalue
- DoubleScalar<U>; the strongly typed value to storeValueException
- when index out of range (index < 0 or index >= size())public final void setInUnit(int index, double value, U valueUnit) throws ValueException
index
- int; index of the value to replacevalue
- double; the value to store (which is expressed in valueUnit)valueUnit
- U; unit of the supplied valueValueException
- when index out of range (index < 0 or index >= size())public final void normalize() throws ValueException
ValueException
- when the sum of the values is zero and normalization is not possibleCopyright © 2015–2018 Delft University of Technology. All rights reserved.