Interface RealVector
- All Known Subinterfaces:
SparseRealVector
- All Known Implementing Classes:
AbstractRealVector,ArrayRealVector,OpenMapRealVector
vector element indexing is 0-based -- e.g., getEntry(0)
returns the first element of the vector.
The various mapXxx and mapXxxToSelf methods operate
on vectors element-wise, i.e. they perform the same operation (adding a scalar,
applying a function ...) on each element in turn. The mapXxx
versions create a new vector to hold the result and do not change the instance.
The mapXxxToSelf versions use the instance itself to store the
results, so the instance is changed by these methods. In both cases, the result
vector is returned by the methods, this allows to use the fluent API
style, like this:
RealVector result = v.mapAddToSelf(3.0).mapTanToSelf().mapSquareToSelf();
Remark on the deprecated mapXxx and mapXxxToSelf methods: In
Commons-Math v3.0, the same functionality will be achieved by directly using the
map(UnivariateRealFunction) and mapToSelf(UnivariateRealFunction)
together with new function objects (not available in v2.2).
- Since:
- 2.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classClass representing a modifiable entry in the vector. -
Method Summary
Modifier and TypeMethodDescriptionadd(double[] v) Compute the sum of this vector andv.add(RealVector v) Compute the sum of this vector andv.append(double d) Construct a vector by appending a double to this vector.append(double[] a) Construct a vector by appending a double array to this vector.append(RealVector v) Construct a vector by appending a vector to this vector.copy()Returns a (deep) copy of this vector.doubledotProduct(double[] v) Compute the dot product.doubleCompute the dot product.ebeDivide(double[] v) Element-by-element division.Element-by-element division.ebeMultiply(double[] v) Element-by-element multiplication.Element-by-element multiplication.double[]getData()Returns vector entries as a double array.intReturns the size of the vector.doublegetDistance(double[] v) Distance between two vectors.doubleDistance between two vectors.doublegetEntry(int index) Returns the entry in the specified index.doublegetL1Distance(double[] v) Distance between two vectors.doubleDistance between two vectors.doubleReturns the L1 norm of the vector.doublegetLInfDistance(double[] v) Distance between two vectors.doubleDistance between two vectors.doubleReturns the L∞ norm of the vector.doublegetNorm()Returns the L2 norm of the vector.getSubVector(int index, int n) Get a subvector from consecutive elements.booleanCheck whether any coordinate of this vector is infinite and none areNaN.booleanisNaN()Check whether any coordinate of this vector isNaN.iterator()Generic dense iterator.map(UnivariateRealFunction function) Acts as if implemented as:mapAbs()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapAcos()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapAdd(double d) Add a value to each entry.mapAddToSelf(double d) Add a value to each entry.mapAsin()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapAtan()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapCbrt()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapCeil()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapCos()Deprecated.in 2.2 (to be removed in 3.0).mapCosh()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapDivide(double d) Divide each entry.mapDivideToSelf(double d) Divide each entry.mapExp()Deprecated.in 2.2 (to be removed in 3.0).mapExpm1()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapFloor()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapInv()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapLog()Deprecated.in 2.2 (to be removed in 3.0).mapLog10()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapLog1p()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapMultiply(double d) Multiply each entry.mapMultiplyToSelf(double d) Multiply each entry.mapPow(double d) Deprecated.in 2.2 (to be removed in 3.0).mapPowToSelf(double d) Deprecated.in 2.2 (to be removed in 3.0).mapRint()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapSin()Deprecated.in 2.2 (to be removed in 3.0).mapSinh()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapSqrt()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapSubtract(double d) Subtract a value from each entry.mapSubtractToSelf(double d) Subtract a value from each entry.mapTan()Deprecated.in 2.2 (to be removed in 3.0).mapTanh()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).mapToSelf(UnivariateRealFunction function) Acts as if it is implemented as:mapUlp()Deprecated.in 2.2 (to be removed in 3.0).Deprecated.in 2.2 (to be removed in 3.0).outerProduct(double[] v) Compute the outer product.Compute the outer product.projection(double[] v) Find the orthogonal projection of this vector onto another vector.Find the orthogonal projection of this vector onto another vector.voidset(double value) Set all elements to a single value.voidsetEntry(int index, double value) Set a single element.voidsetSubVector(int index, double[] v) Set a set of consecutive elements.voidsetSubVector(int index, RealVector v) Set a set of consecutive elements.Specialized implementations may choose to not iterate over all dimensions, either because those values are unset, or are equal to defaultValue(), or are small enough to be ignored for the purposes of iteration.subtract(double[] v) Subtractvfrom this vector.Subtractvfrom this vector.double[]toArray()Convert the vector to a double array.voidunitize()Converts this vector into a unit vector.Creates a unit vector pointing in the direction of this vector.
-
Method Details
-
mapToSelf
Acts as if it is implemented as:Entry e = null; for(Iterator
it = iterator(); it.hasNext(); e = it.next()) { e.setValue(function.value(e.getValue())); } - Parameters:
function- Function to apply to each entry.- Returns:
- this vector.
- Throws:
FunctionEvaluationException- if the function throws it.
-
map
Acts as if implemented as:return copy().map(function);
- Parameters:
function- Function to apply to each entry.- Returns:
- a new vector.
- Throws:
FunctionEvaluationException- if the function throws it.
-
iterator
Iterator<RealVector.Entry> iterator()Generic dense iterator. It iterates in increasing order of the vector index.- Returns:
- a dense iterator
-
sparseIterator
Iterator<RealVector.Entry> sparseIterator()Specialized implementations may choose to not iterate over all dimensions, either because those values are unset, or are equal to defaultValue(), or are small enough to be ignored for the purposes of iteration. No guarantees are made about order of iteration. In dense implementations, this method will often delegate toiterator().- Returns:
- a sparse iterator
-
copy
RealVector copy()Returns a (deep) copy of this vector.- Returns:
- a vector copy.
-
add
Compute the sum of this vector andv.- Parameters:
v- Vector to be added.- Returns:
this+v.- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
add
Compute the sum of this vector andv.- Parameters:
v- Vector to be added.- Returns:
this+v.- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
subtract
Subtractvfrom this vector.- Parameters:
v- Vector to be subtracted.- Returns:
this-v.- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
subtract
Subtractvfrom this vector.- Parameters:
v- Vector to be subtracted.- Returns:
this-v.- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
mapAdd
Add a value to each entry.- Parameters:
d- Value to be added to each entry.- Returns:
this+d.
-
mapAddToSelf
Add a value to each entry. The instance is changed in-place.- Parameters:
d- Value to be added to each entry.- Returns:
this.
-
mapSubtract
Subtract a value from each entry.- Parameters:
d- Value to be subtracted.- Returns:
this-d.
-
mapSubtractToSelf
Subtract a value from each entry. The instance is changed in-place.- Parameters:
d- Value to be subtracted.- Returns:
this.
-
mapMultiply
Multiply each entry.- Parameters:
d- Multiplication factor.- Returns:
this*d.
-
mapMultiplyToSelf
Multiply each entry. The instance is changed in-place.- Parameters:
d- Multiplication factor.- Returns:
this.
-
mapDivide
Divide each entry.- Parameters:
d- Value to divide by.- Returns:
this/d.
-
mapDivideToSelf
Divide each entry. The instance is changed in-place.- Parameters:
d- Value to divide by.- Returns:
this.
-
mapPow
Deprecated.in 2.2 (to be removed in 3.0).Map a power operation to each entry.- Parameters:
d- Operator value.- Returns:
- a mapped copy of the vector.
-
mapPowToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map a power operation to each entry. The instance is changed in-place.- Parameters:
d- Operator value.- Returns:
- the mapped vector.
-
mapExp
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.exp(double)function to each entry.- Returns:
- a mapped copy of the vector.
-
mapExpToSelf
Deprecated.in 2.2 (to be removed in 3.0).MapMath.exp(double)operation to each entry. The instance is changed in-place.- Returns:
- the mapped vector.
-
mapExpm1
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.expm1(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapExpm1ToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.expm1(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapLog
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.log(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapLogToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.log(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapLog10
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.log10(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapLog10ToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.log10(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapLog1p
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.log1p(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapLog1pToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.log1p(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapCosh
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.cosh(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapCoshToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.cosh(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapSinh
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.sinh(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapSinhToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.sinh(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapTanh
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.tanh(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapTanhToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.tanh(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapCos
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.cos(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapCosToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.cos(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapSin
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.sin(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapSinToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.sin(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapTan
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.tan(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapTanToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.tan(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapAcos
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.acos(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapAcosToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.acos(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapAsin
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.asin(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapAsinToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.asin(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapAtan
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.atan(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapAtanToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.atan(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapInv
Deprecated.in 2.2 (to be removed in 3.0).Map the 1/x function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapInvToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map the 1/x function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapAbs
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.abs(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapAbsToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.abs(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapSqrt
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.sqrt(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapSqrtToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.sqrt(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapCbrt
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.cbrt(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapCbrtToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.cbrt(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapCeil
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.ceil(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapCeilToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.ceil(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapFloor
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.floor(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapFloorToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.floor(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapRint
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.rint(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapRintToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.rint(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapSignum
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.signum(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapSignumToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.signum(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
mapUlp
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.ulp(double)function to each entry.- Returns:
- a vector containing the result of applying the function to each entry
-
mapUlpToSelf
Deprecated.in 2.2 (to be removed in 3.0).Map theMath.ulp(double)function to each entry.The instance is changed by this method.
- Returns:
- for convenience, return this
-
ebeMultiply
Element-by-element multiplication.- Parameters:
v- vector by which instance elements must be multiplied- Returns:
- a vector containing this[i] * v[i] for all i
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
ebeMultiply
Element-by-element multiplication.- Parameters:
v- vector by which instance elements must be multiplied- Returns:
- a vector containing this[i] * v[i] for all i
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
ebeDivide
Element-by-element division.- Parameters:
v- vector by which instance elements must be divided- Returns:
- a vector containing this[i] / v[i] for all i
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
ebeDivide
Element-by-element division.- Parameters:
v- vector by which instance elements must be divided- Returns:
- a vector containing this[i] / v[i] for all i
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
getData
double[] getData()Returns vector entries as a double array.- Returns:
- double array of entries
-
dotProduct
Compute the dot product.- Parameters:
v- vector with which dot product should be computed- Returns:
- the scalar dot product between instance and v
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
dotProduct
double dotProduct(double[] v) Compute the dot product.- Parameters:
v- vector with which dot product should be computed- Returns:
- the scalar dot product between instance and v
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
getNorm
double getNorm()Returns the L2 norm of the vector.The L2 norm is the root of the sum of the squared elements.
- Returns:
- norm
- See Also:
-
getL1Norm
double getL1Norm()Returns the L1 norm of the vector.The L1 norm is the sum of the absolute values of elements.
- Returns:
- norm
- See Also:
-
getLInfNorm
double getLInfNorm()Returns the L∞ norm of the vector.The L∞ norm is the max of the absolute values of elements.
- Returns:
- norm
- See Also:
-
getDistance
Distance between two vectors.This method computes the distance consistent with the L2 norm, i.e. the square root of the sum of elements differences, or euclidian distance.
- Parameters:
v- vector to which distance is requested- Returns:
- distance between two vectors.
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.- See Also:
-
getDistance
double getDistance(double[] v) Distance between two vectors.This method computes the distance consistent with the L2 norm, i.e. the square root of the sum of elements differences, or euclidian distance.
- Parameters:
v- vector to which distance is requested- Returns:
- distance between two vectors.
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.- See Also:
-
getL1Distance
Distance between two vectors.This method computes the distance consistent with L1 norm, i.e. the sum of the absolute values of elements differences.
- Parameters:
v- vector to which distance is requested- Returns:
- distance between two vectors.
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.- See Also:
-
getL1Distance
double getL1Distance(double[] v) Distance between two vectors.This method computes the distance consistent with L1 norm, i.e. the sum of the absolute values of elements differences.
- Parameters:
v- vector to which distance is requested- Returns:
- distance between two vectors.
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.- See Also:
-
getLInfDistance
Distance between two vectors.This method computes the distance consistent with L∞ norm, i.e. the max of the absolute values of elements differences.
- Parameters:
v- vector to which distance is requested- Returns:
- distance between two vectors.
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.- See Also:
-
getLInfDistance
double getLInfDistance(double[] v) Distance between two vectors.This method computes the distance consistent with L∞ norm, i.e. the max of the absolute values of elements differences.
- Parameters:
v- vector to which distance is requested- Returns:
- distance between two vectors.
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.- See Also:
-
unitVector
RealVector unitVector()Creates a unit vector pointing in the direction of this vector.The instance is not changed by this method.
- Returns:
- a unit vector pointing in direction of this vector
- Throws:
ArithmeticException- if the norm is null
-
unitize
void unitize()Converts this vector into a unit vector.The instance itself is changed by this method.
- Throws:
ArithmeticException- if the norm is zero.
-
projection
Find the orthogonal projection of this vector onto another vector.- Parameters:
v- vector onto which instance must be projected- Returns:
- projection of the instance onto v
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
projection
Find the orthogonal projection of this vector onto another vector.- Parameters:
v- vector onto which instance must be projected- Returns:
- projection of the instance onto v
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
outerProduct
Compute the outer product.- Parameters:
v- vector with which outer product should be computed- Returns:
- the square matrix outer product between instance and v
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
outerProduct
Compute the outer product.- Parameters:
v- vector with which outer product should be computed- Returns:
- the square matrix outer product between instance and v
- Throws:
DimensionMismatchException- ifvis not the same size as this vector.
-
getEntry
double getEntry(int index) Returns the entry in the specified index.- Parameters:
index- Index location of entry to be fetched.- Returns:
- the vector entry at
index. - Throws:
OutOfRangeException- if the index is not valid.- See Also:
-
setEntry
void setEntry(int index, double value) Set a single element.- Parameters:
index- element index.value- new value for the element.- Throws:
OutOfRangeException- if the index is not valid.- See Also:
-
getDimension
int getDimension()Returns the size of the vector.- Returns:
- size
-
append
Construct a vector by appending a vector to this vector.- Parameters:
v- vector to append to this one.- Returns:
- a new vector
-
append
Construct a vector by appending a double to this vector.- Parameters:
d- double to append.- Returns:
- a new vector
-
append
Construct a vector by appending a double array to this vector.- Parameters:
a- double array to append.- Returns:
- a new vector
-
getSubVector
Get a subvector from consecutive elements.- Parameters:
index- index of first element.n- number of elements to be retrieved.- Returns:
- a vector containing n elements.
- Throws:
OutOfRangeException- if the index is not valid.
-
setSubVector
Set a set of consecutive elements.- Parameters:
index- index of first element to be set.v- vector containing the values to set.- Throws:
OutOfRangeException- if the index is not valid.- See Also:
-
setSubVector
void setSubVector(int index, double[] v) Set a set of consecutive elements.- Parameters:
index- index of first element to be set.v- vector containing the values to set.- Throws:
OutOfRangeException- if the index is not valid.- See Also:
-
set
void set(double value) Set all elements to a single value.- Parameters:
value- single value to set for all elements
-
toArray
double[] toArray()Convert the vector to a double array.The array is independent from vector data, it's elements are copied.
- Returns:
- array containing a copy of vector elements
-
isNaN
boolean isNaN()Check whether any coordinate of this vector isNaN.- Returns:
trueif any coordinate of this vector isNaN,falseotherwise.
-
isInfinite
boolean isInfinite()Check whether any coordinate of this vector is infinite and none areNaN.- Returns:
trueif any coordinate of this vector is infinite and none areNaN,falseotherwise.
-