public class ArrayRealVector extends AbstractRealVector implements java.io.Serializable
RealVector
interface with a double array.RealVector.Entry
Constructor and Description |
---|
ArrayRealVector()
Build a 0-length vector.
|
ArrayRealVector(ArrayRealVector v)
Construct a vector from another vector, using a deep copy.
|
ArrayRealVector(ArrayRealVector v1,
ArrayRealVector v2)
Construct a vector by appending one vector to another vector.
|
ArrayRealVector(ArrayRealVector v,
boolean deep)
Construct a vector from another vector.
|
ArrayRealVector(ArrayRealVector v1,
double[] v2)
Construct a vector by appending one vector to another vector.
|
ArrayRealVector(ArrayRealVector v1,
RealVector v2)
Construct a vector by appending one vector to another vector.
|
ArrayRealVector(double[] d)
Construct a vector from an array, copying the input array.
|
ArrayRealVector(java.lang.Double[] d)
Construct a vector from an array.
|
ArrayRealVector(double[] v1,
ArrayRealVector v2)
Construct a vector by appending one vector to another vector.
|
ArrayRealVector(double[] d,
boolean copyArray)
Create a new ArrayRealVector using the input array as the underlying
data array.
|
ArrayRealVector(double[] v1,
double[] v2)
Construct a vector by appending one vector to another vector.
|
ArrayRealVector(double[] d,
int pos,
int size)
Construct a vector from part of a array.
|
ArrayRealVector(java.lang.Double[] d,
int pos,
int size)
Construct a vector from part of a Double array
|
ArrayRealVector(int size)
Construct a (size)-length vector of zeros.
|
ArrayRealVector(int size,
double preset)
Construct an (size)-length vector with preset values.
|
ArrayRealVector(RealVector v)
Construct a vector from another vector, using a deep copy.
|
ArrayRealVector(RealVector v1,
ArrayRealVector v2)
Construct a vector by appending one vector to another vector.
|
Modifier and Type | Method and Description |
---|---|
ArrayRealVector |
add(ArrayRealVector v)
Compute the sum of this and v.
|
RealVector |
add(double[] v)
Compute the sum of this vector and
v . |
RealVector |
add(RealVector v)
Compute the sum of this vector and
v . |
ArrayRealVector |
append(ArrayRealVector v)
Construct a vector by appending a vector to this vector.
|
RealVector |
append(double in)
Construct a vector by appending a double to this vector.
|
RealVector |
append(double[] in)
Construct a vector by appending a double array to this vector.
|
RealVector |
append(RealVector v)
Construct a vector by appending a vector to this vector.
|
AbstractRealVector |
copy()
Returns a (deep) copy of this vector.
|
double |
dotProduct(ArrayRealVector v)
Compute the dot product.
|
double |
dotProduct(double[] v)
Compute the dot product.
|
double |
dotProduct(RealVector v)
Compute the dot product.
|
ArrayRealVector |
ebeDivide(ArrayRealVector v)
Element-by-element division.
|
RealVector |
ebeDivide(double[] v)
Element-by-element division.
|
RealVector |
ebeDivide(RealVector v)
Element-by-element division.
|
ArrayRealVector |
ebeMultiply(ArrayRealVector v)
Element-by-element multiplication.
|
RealVector |
ebeMultiply(double[] v)
Element-by-element multiplication.
|
RealVector |
ebeMultiply(RealVector v)
Element-by-element multiplication.
|
boolean |
equals(java.lang.Object other)
Test for the equality of two real vectors.
|
double[] |
getData()
Returns vector entries as a double array.
|
double[] |
getDataRef()
Returns a reference to the underlying data array.
|
int |
getDimension()
Returns the size of the vector.
|
double |
getDistance(ArrayRealVector v)
Distance between two vectors.
|
double |
getDistance(double[] v)
Distance between two vectors.
|
double |
getDistance(RealVector v)
Distance between two vectors.
|
double |
getEntry(int index)
Returns the entry in the specified index.
|
double |
getL1Distance(ArrayRealVector v)
Distance between two vectors.
|
double |
getL1Distance(double[] v)
Distance between two vectors.
|
double |
getL1Distance(RealVector v)
Distance between two vectors.
|
double |
getL1Norm()
Returns the L1 norm of the vector.
|
double |
getLInfDistance(ArrayRealVector v)
Distance between two vectors.
|
double |
getLInfDistance(double[] v)
Distance between two vectors.
|
double |
getLInfDistance(RealVector v)
Distance between two vectors.
|
double |
getLInfNorm()
Returns the L∞ norm of the vector.
|
double |
getNorm()
Returns the L2 norm of the vector.
|
RealVector |
getSubVector(int index,
int n)
Get a subvector from consecutive elements.
|
int |
hashCode()
Get a hashCode for the real vector.
|
boolean |
isInfinite()
Returns true if any coordinate of this vector is infinite and none are NaN;
false otherwise
|
boolean |
isNaN()
Returns true if any coordinate of this vector is NaN; false otherwise
|
RealVector |
mapAbsToSelf()
Map the
Math.abs(double) function to each entry. |
RealVector |
mapAcosToSelf()
Map the
Math.acos(double) function to each entry. |
RealVector |
mapAddToSelf(double d)
Add a value to each entry.
|
RealVector |
mapAsinToSelf()
Map the
Math.asin(double) function to each entry. |
RealVector |
mapAtanToSelf()
Map the
Math.atan(double) function to each entry. |
RealVector |
mapCbrtToSelf()
Map the
Math.cbrt(double) function to each entry. |
RealVector |
mapCeilToSelf()
Map the
Math.ceil(double) function to each entry. |
RealVector |
mapCoshToSelf()
Map the
Math.cosh(double) function to each entry. |
RealVector |
mapCosToSelf()
Map the
Math.cos(double) function to each entry. |
RealVector |
mapDivideToSelf(double d)
Divide each entry.
|
RealVector |
mapExpm1ToSelf()
Map the
Math.expm1(double) function to each entry. |
RealVector |
mapExpToSelf()
Map
Math.exp(double) operation to each entry. |
RealVector |
mapFloorToSelf()
Map the
Math.floor(double) function to each entry. |
RealVector |
mapInvToSelf()
Map the 1/x function to each entry.
|
RealVector |
mapLog10ToSelf()
Map the
Math.log10(double) function to each entry. |
RealVector |
mapLog1pToSelf()
Map the
Math.log1p(double) function to each entry. |
RealVector |
mapLogToSelf()
Map the
Math.log(double) function to each entry. |
RealVector |
mapMultiplyToSelf(double d)
Multiply each entry.
|
RealVector |
mapPowToSelf(double d)
Map a power operation to each entry.
|
RealVector |
mapRintToSelf()
Map the
Math.rint(double) function to each entry. |
RealVector |
mapSignumToSelf()
Map the
Math.signum(double) function to each entry. |
RealVector |
mapSinhToSelf()
Map the
Math.sinh(double) function to each entry. |
RealVector |
mapSinToSelf()
Map the
Math.sin(double) function to each entry. |
RealVector |
mapSqrtToSelf()
Map the
Math.sqrt(double) function to each entry. |
RealVector |
mapSubtractToSelf(double d)
Subtract a value from each entry.
|
RealVector |
mapTanhToSelf()
Map the
Math.tanh(double) function to each entry. |
RealVector |
mapTanToSelf()
Map the
Math.tan(double) function to each entry. |
RealVector |
mapUlpToSelf()
Map the
Math.ulp(double) function to each entry. |
RealMatrix |
outerProduct(ArrayRealVector v)
Compute the outer product.
|
RealMatrix |
outerProduct(double[] v)
Compute the outer product.
|
RealMatrix |
outerProduct(RealVector v)
Compute the outer product.
|
ArrayRealVector |
projection(ArrayRealVector v)
Find the orthogonal projection of this vector onto another vector.
|
RealVector |
projection(double[] v)
Find the orthogonal projection of this vector onto another vector.
|
RealVector |
projection(RealVector v)
Find the orthogonal projection of this vector onto another vector.
|
void |
set(double value)
Set all elements to a single value.
|
void |
set(int index,
ArrayRealVector v)
Set a set of consecutive elements.
|
void |
setEntry(int index,
double value)
Set a single element.
|
void |
setSubVector(int index,
double[] v)
Set a set of consecutive elements.
|
void |
setSubVector(int index,
RealVector v)
Set a set of consecutive elements.
|
ArrayRealVector |
subtract(ArrayRealVector v)
Compute this minus v.
|
RealVector |
subtract(double[] v)
Subtract
v from this vector. |
RealVector |
subtract(RealVector v)
Subtract
v from this vector. |
double[] |
toArray()
Convert the vector to a double array.
|
java.lang.String |
toString() |
void |
unitize()
Converts this vector into a unit vector.
|
RealVector |
unitVector()
Creates a unit vector pointing in the direction of this vector.
|
getMaxIndex, getMaxValue, getMinIndex, getMinValue, iterator, map, mapAbs, mapAcos, mapAdd, mapAsin, mapAtan, mapCbrt, mapCeil, mapCos, mapCosh, mapDivide, mapExp, mapExpm1, mapFloor, mapInv, mapLog, mapLog10, mapLog1p, mapMultiply, mapPow, mapRint, mapSignum, mapSin, mapSinh, mapSqrt, mapSubtract, mapTan, mapTanh, mapToSelf, mapUlp, sparseIterator
public ArrayRealVector()
Zero-length vectors may be used to initialized construction of vectors
by data gathering. We start with zero-length and use either the ArrayRealVector(ArrayRealVector, ArrayRealVector)
constructor
or one of the append
method (append(double)
, append(double[])
, append(ArrayRealVector)
) to gather data
into this vector.
public ArrayRealVector(int size)
size
- size of the vectorpublic ArrayRealVector(int size, double preset)
size
- size of the vectorpreset
- fill the vector with this scalar valuepublic ArrayRealVector(double[] d)
d
- array of doubles.public ArrayRealVector(double[] d, boolean copyArray)
If an array is built specially in order to be embedded in a
ArrayRealVector and not used directly, the copyArray
may be
set to false
d
- data for new vectorcopyArray
- if true, the input array will be copied, otherwise
it will be referencedArrayRealVector(double[])
public ArrayRealVector(double[] d, int pos, int size)
d
- array of doubles.pos
- position of first entrysize
- number of entries to copypublic ArrayRealVector(java.lang.Double[] d)
d
- array of Doubles.public ArrayRealVector(java.lang.Double[] d, int pos, int size)
d
- array of Doubles.pos
- position of first entrysize
- number of entries to copypublic ArrayRealVector(RealVector v)
v
- vector to copypublic ArrayRealVector(ArrayRealVector v)
v
- vector to copypublic ArrayRealVector(ArrayRealVector v, boolean deep)
v
- vector to copydeep
- if true perform a deep copy otherwise perform a shallow copypublic ArrayRealVector(ArrayRealVector v1, ArrayRealVector v2)
v1
- first vector (will be put in front of the new vector)v2
- second vector (will be put at back of the new vector)public ArrayRealVector(ArrayRealVector v1, RealVector v2)
v1
- first vector (will be put in front of the new vector)v2
- second vector (will be put at back of the new vector)public ArrayRealVector(RealVector v1, ArrayRealVector v2)
v1
- first vector (will be put in front of the new vector)v2
- second vector (will be put at back of the new vector)public ArrayRealVector(ArrayRealVector v1, double[] v2)
v1
- first vector (will be put in front of the new vector)v2
- second vector (will be put at back of the new vector)public ArrayRealVector(double[] v1, ArrayRealVector v2)
v1
- first vector (will be put in front of the new vector)v2
- second vector (will be put at back of the new vector)public ArrayRealVector(double[] v1, double[] v2)
v1
- first vector (will be put in front of the new vector)v2
- second vector (will be put at back of the new vector)public AbstractRealVector copy()
copy
in interface RealVector
copy
in class AbstractRealVector
public RealVector add(RealVector v) throws java.lang.IllegalArgumentException
v
.add
in interface RealVector
add
in class AbstractRealVector
v
- Vector to be added.this
+ v
.DimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public RealVector add(double[] v) throws java.lang.IllegalArgumentException
v
.add
in interface RealVector
add
in class AbstractRealVector
v
- Vector to be added.this
+ v
.DimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public ArrayRealVector add(ArrayRealVector v) throws java.lang.IllegalArgumentException
v
- vector to be addedjava.lang.IllegalArgumentException
- if v is not the same size as thispublic RealVector subtract(RealVector v) throws java.lang.IllegalArgumentException
v
from this vector.subtract
in interface RealVector
subtract
in class AbstractRealVector
v
- Vector to be subtracted.this
- v
.DimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public RealVector subtract(double[] v) throws java.lang.IllegalArgumentException
v
from this vector.subtract
in interface RealVector
subtract
in class AbstractRealVector
v
- Vector to be subtracted.this
- v
.DimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public ArrayRealVector subtract(ArrayRealVector v) throws java.lang.IllegalArgumentException
v
- vector to be subtractedjava.lang.IllegalArgumentException
- if v is not the same size as thispublic RealVector mapAddToSelf(double d)
mapAddToSelf
in interface RealVector
mapAddToSelf
in class AbstractRealVector
d
- Value to be added to each entry.this
.public RealVector mapSubtractToSelf(double d)
mapSubtractToSelf
in interface RealVector
mapSubtractToSelf
in class AbstractRealVector
d
- Value to be subtracted.this
.public RealVector mapMultiplyToSelf(double d)
mapMultiplyToSelf
in interface RealVector
mapMultiplyToSelf
in class AbstractRealVector
d
- Multiplication factor.this
.public RealVector mapDivideToSelf(double d)
mapDivideToSelf
in interface RealVector
mapDivideToSelf
in class AbstractRealVector
d
- Value to divide by.this
.public RealVector mapPowToSelf(double d)
mapPowToSelf
in interface RealVector
mapPowToSelf
in class AbstractRealVector
d
- Operator value.public RealVector mapExpToSelf()
Math.exp(double)
operation to each entry.
The instance is changed in-place.mapExpToSelf
in interface RealVector
mapExpToSelf
in class AbstractRealVector
public RealVector mapExpm1ToSelf()
Math.expm1(double)
function to each entry.
The instance is changed by this method.
mapExpm1ToSelf
in interface RealVector
mapExpm1ToSelf
in class AbstractRealVector
public RealVector mapLogToSelf()
Math.log(double)
function to each entry.
The instance is changed by this method.
mapLogToSelf
in interface RealVector
mapLogToSelf
in class AbstractRealVector
public RealVector mapLog10ToSelf()
Math.log10(double)
function to each entry.
The instance is changed by this method.
mapLog10ToSelf
in interface RealVector
mapLog10ToSelf
in class AbstractRealVector
public RealVector mapLog1pToSelf()
Math.log1p(double)
function to each entry.
The instance is changed by this method.
mapLog1pToSelf
in interface RealVector
mapLog1pToSelf
in class AbstractRealVector
public RealVector mapCoshToSelf()
Math.cosh(double)
function to each entry.
The instance is changed by this method.
mapCoshToSelf
in interface RealVector
mapCoshToSelf
in class AbstractRealVector
public RealVector mapSinhToSelf()
Math.sinh(double)
function to each entry.
The instance is changed by this method.
mapSinhToSelf
in interface RealVector
mapSinhToSelf
in class AbstractRealVector
public RealVector mapTanhToSelf()
Math.tanh(double)
function to each entry.
The instance is changed by this method.
mapTanhToSelf
in interface RealVector
mapTanhToSelf
in class AbstractRealVector
public RealVector mapCosToSelf()
Math.cos(double)
function to each entry.
The instance is changed by this method.
mapCosToSelf
in interface RealVector
mapCosToSelf
in class AbstractRealVector
public RealVector mapSinToSelf()
Math.sin(double)
function to each entry.
The instance is changed by this method.
mapSinToSelf
in interface RealVector
mapSinToSelf
in class AbstractRealVector
public RealVector mapTanToSelf()
Math.tan(double)
function to each entry.
The instance is changed by this method.
mapTanToSelf
in interface RealVector
mapTanToSelf
in class AbstractRealVector
public RealVector mapAcosToSelf()
Math.acos(double)
function to each entry.
The instance is changed by this method.
mapAcosToSelf
in interface RealVector
mapAcosToSelf
in class AbstractRealVector
public RealVector mapAsinToSelf()
Math.asin(double)
function to each entry.
The instance is changed by this method.
mapAsinToSelf
in interface RealVector
mapAsinToSelf
in class AbstractRealVector
public RealVector mapAtanToSelf()
Math.atan(double)
function to each entry.
The instance is changed by this method.
mapAtanToSelf
in interface RealVector
mapAtanToSelf
in class AbstractRealVector
public RealVector mapInvToSelf()
The instance is changed by this method.
mapInvToSelf
in interface RealVector
mapInvToSelf
in class AbstractRealVector
public RealVector mapAbsToSelf()
Math.abs(double)
function to each entry.
The instance is changed by this method.
mapAbsToSelf
in interface RealVector
mapAbsToSelf
in class AbstractRealVector
public RealVector mapSqrtToSelf()
Math.sqrt(double)
function to each entry.
The instance is changed by this method.
mapSqrtToSelf
in interface RealVector
mapSqrtToSelf
in class AbstractRealVector
public RealVector mapCbrtToSelf()
Math.cbrt(double)
function to each entry.
The instance is changed by this method.
mapCbrtToSelf
in interface RealVector
mapCbrtToSelf
in class AbstractRealVector
public RealVector mapCeilToSelf()
Math.ceil(double)
function to each entry.
The instance is changed by this method.
mapCeilToSelf
in interface RealVector
mapCeilToSelf
in class AbstractRealVector
public RealVector mapFloorToSelf()
Math.floor(double)
function to each entry.
The instance is changed by this method.
mapFloorToSelf
in interface RealVector
mapFloorToSelf
in class AbstractRealVector
public RealVector mapRintToSelf()
Math.rint(double)
function to each entry.
The instance is changed by this method.
mapRintToSelf
in interface RealVector
mapRintToSelf
in class AbstractRealVector
public RealVector mapSignumToSelf()
Math.signum(double)
function to each entry.
The instance is changed by this method.
mapSignumToSelf
in interface RealVector
mapSignumToSelf
in class AbstractRealVector
public RealVector mapUlpToSelf()
Math.ulp(double)
function to each entry.
The instance is changed by this method.
mapUlpToSelf
in interface RealVector
mapUlpToSelf
in class AbstractRealVector
public RealVector ebeMultiply(RealVector v) throws java.lang.IllegalArgumentException
ebeMultiply
in interface RealVector
v
- vector by which instance elements must be multipliedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public RealVector ebeMultiply(double[] v) throws java.lang.IllegalArgumentException
ebeMultiply
in interface RealVector
ebeMultiply
in class AbstractRealVector
v
- vector by which instance elements must be multipliedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public ArrayRealVector ebeMultiply(ArrayRealVector v) throws java.lang.IllegalArgumentException
v
- vector by which instance elements must be multipliedjava.lang.IllegalArgumentException
- if v is not the same size as thispublic RealVector ebeDivide(RealVector v) throws java.lang.IllegalArgumentException
ebeDivide
in interface RealVector
v
- vector by which instance elements must be dividedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public RealVector ebeDivide(double[] v) throws java.lang.IllegalArgumentException
ebeDivide
in interface RealVector
ebeDivide
in class AbstractRealVector
v
- vector by which instance elements must be dividedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public ArrayRealVector ebeDivide(ArrayRealVector v) throws java.lang.IllegalArgumentException
v
- vector by which instance elements must be dividedjava.lang.IllegalArgumentException
- if v is not the same size as thispublic double[] getData()
getData
in interface RealVector
getData
in class AbstractRealVector
public double[] getDataRef()
Does not make a fresh copy of the underlying data.
public double dotProduct(RealVector v) throws java.lang.IllegalArgumentException
dotProduct
in interface RealVector
dotProduct
in class AbstractRealVector
v
- vector with which dot product should be computedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public double dotProduct(double[] v) throws java.lang.IllegalArgumentException
dotProduct
in interface RealVector
dotProduct
in class AbstractRealVector
v
- vector with which dot product should be computedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public double dotProduct(ArrayRealVector v) throws java.lang.IllegalArgumentException
v
- vector with which dot product should be computedjava.lang.IllegalArgumentException
- if v is not the same size as thispublic double getNorm()
The L2 norm is the root of the sum of the squared elements.
getNorm
in interface RealVector
getNorm
in class AbstractRealVector
RealVector.getL1Norm()
,
RealVector.getLInfNorm()
,
RealVector.getDistance(RealVector)
public double getL1Norm()
The L1 norm is the sum of the absolute values of elements.
getL1Norm
in interface RealVector
getL1Norm
in class AbstractRealVector
RealVector.getNorm()
,
RealVector.getLInfNorm()
,
RealVector.getL1Distance(RealVector)
public double getLInfNorm()
The L∞ norm is the max of the absolute values of elements.
getLInfNorm
in interface RealVector
getLInfNorm
in class AbstractRealVector
RealVector.getNorm()
,
RealVector.getL1Norm()
,
RealVector.getLInfDistance(RealVector)
public double getDistance(RealVector v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with the L2 norm, i.e. the square root of the sum of elements differences, or euclidian distance.
getDistance
in interface RealVector
getDistance
in class AbstractRealVector
v
- vector to which distance is requestedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
RealVector.getL1Distance(RealVector)
,
RealVector.getLInfDistance(RealVector)
,
RealVector.getNorm()
public double getDistance(double[] v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with the L2 norm, i.e. the square root of the sum of elements differences, or euclidian distance.
getDistance
in interface RealVector
getDistance
in class AbstractRealVector
v
- vector to which distance is requestedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
RealVector.getL1Distance(double[])
,
RealVector.getLInfDistance(double[])
,
RealVector.getNorm()
public double getDistance(ArrayRealVector v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with the L2 norm, i.e. the square root of the sum of elements differences, or euclidian distance.
v
- vector to which distance is requestedjava.lang.IllegalArgumentException
- if v is not the same size as thisgetDistance(RealVector)
,
getL1Distance(ArrayRealVector)
,
getLInfDistance(ArrayRealVector)
,
getNorm()
public double getL1Distance(RealVector v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with L1 norm, i.e. the sum of the absolute values of elements differences.
getL1Distance
in interface RealVector
getL1Distance
in class AbstractRealVector
v
- vector to which distance is requestedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
RealVector.getDistance(RealVector)
,
RealVector.getLInfDistance(RealVector)
,
RealVector.getL1Norm()
public double getL1Distance(double[] v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with L1 norm, i.e. the sum of the absolute values of elements differences.
getL1Distance
in interface RealVector
getL1Distance
in class AbstractRealVector
v
- vector to which distance is requestedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
RealVector.getDistance(double[])
,
RealVector.getLInfDistance(double[])
,
RealVector.getL1Norm()
public double getL1Distance(ArrayRealVector v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with L1 norm, i.e. the sum of the absolute values of elements differences.
v
- vector to which distance is requestedjava.lang.IllegalArgumentException
- if v is not the same size as thisgetDistance(RealVector)
,
getL1Distance(ArrayRealVector)
,
getLInfDistance(ArrayRealVector)
,
getNorm()
public double getLInfDistance(RealVector v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with L∞ norm, i.e. the max of the absolute values of elements differences.
getLInfDistance
in interface RealVector
getLInfDistance
in class AbstractRealVector
v
- vector to which distance is requestedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
RealVector.getDistance(RealVector)
,
RealVector.getL1Distance(RealVector)
,
RealVector.getLInfNorm()
public double getLInfDistance(double[] v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with L∞ norm, i.e. the max of the absolute values of elements differences.
getLInfDistance
in interface RealVector
getLInfDistance
in class AbstractRealVector
v
- vector to which distance is requestedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
RealVector.getDistance(double[])
,
RealVector.getL1Distance(double[])
,
RealVector.getLInfNorm()
public double getLInfDistance(ArrayRealVector v) throws java.lang.IllegalArgumentException
This method computes the distance consistent with L∞ norm, i.e. the max of the absolute values of elements differences.
v
- vector to which distance is requestedjava.lang.IllegalArgumentException
- if v is not the same size as thisgetDistance(RealVector)
,
getL1Distance(ArrayRealVector)
,
getLInfDistance(ArrayRealVector)
,
getNorm()
public RealVector unitVector() throws java.lang.ArithmeticException
The instance is not changed by this method.
unitVector
in interface RealVector
unitVector
in class AbstractRealVector
java.lang.ArithmeticException
- if the norm is nullpublic void unitize() throws java.lang.ArithmeticException
The instance itself is changed by this method.
unitize
in interface RealVector
unitize
in class AbstractRealVector
java.lang.ArithmeticException
- if the norm is zero.public RealVector projection(RealVector v)
projection
in interface RealVector
v
- vector onto which instance must be projectedpublic RealVector projection(double[] v)
projection
in interface RealVector
projection
in class AbstractRealVector
v
- vector onto which instance must be projectedpublic ArrayRealVector projection(ArrayRealVector v)
v
- vector onto which instance must be projectedjava.lang.IllegalArgumentException
- if v is not the same size as thispublic RealMatrix outerProduct(RealVector v) throws java.lang.IllegalArgumentException
outerProduct
in interface RealVector
outerProduct
in class AbstractRealVector
v
- vector with which outer product should be computedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public RealMatrix outerProduct(ArrayRealVector v) throws java.lang.IllegalArgumentException
v
- vector with which outer product should be computedjava.lang.IllegalArgumentException
- if v is not the same size as thispublic RealMatrix outerProduct(double[] v) throws java.lang.IllegalArgumentException
outerProduct
in interface RealVector
outerProduct
in class AbstractRealVector
v
- vector with which outer product should be computedDimensionMismatchException
- if v
is not the same size as this vector.java.lang.IllegalArgumentException
public double getEntry(int index) throws MatrixIndexException
getEntry
in interface RealVector
index
- Index location of entry to be fetched.index
.MatrixIndexException
RealVector.setEntry(int, double)
public int getDimension()
getDimension
in interface RealVector
public RealVector append(RealVector v)
append
in interface RealVector
v
- vector to append to this one.public ArrayRealVector append(ArrayRealVector v)
v
- vector to append to this one.public RealVector append(double in)
append
in interface RealVector
in
- double to append.public RealVector append(double[] in)
append
in interface RealVector
in
- double array to append.public RealVector getSubVector(int index, int n)
getSubVector
in interface RealVector
index
- index of first element.n
- number of elements to be retrieved.public void setEntry(int index, double value)
setEntry
in interface RealVector
index
- element index.value
- new value for the element.RealVector.getEntry(int)
public void setSubVector(int index, RealVector v)
setSubVector
in interface RealVector
setSubVector
in class AbstractRealVector
index
- index of first element to be set.v
- vector containing the values to set.RealVector.setSubVector(int, double[])
public void setSubVector(int index, double[] v)
setSubVector
in interface RealVector
setSubVector
in class AbstractRealVector
index
- index of first element to be set.v
- vector containing the values to set.RealVector.setSubVector(int, RealVector)
public void set(int index, ArrayRealVector v) throws MatrixIndexException
index
- index of first element to be set.v
- vector containing the values to set.MatrixIndexException
- if the index is
inconsistent with vector sizepublic void set(double value)
set
in interface RealVector
set
in class AbstractRealVector
value
- single value to set for all elementspublic double[] toArray()
The array is independent from vector data, it's elements are copied.
toArray
in interface RealVector
toArray
in class AbstractRealVector
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isNaN()
isNaN
in interface RealVector
public boolean isInfinite()
isInfinite
in interface RealVector
public boolean equals(java.lang.Object other)
If all coordinates of two real vectors are exactly the same, and none are
Double.NaN
, the two real vectors are considered to be equal.
NaN
coordinates are considered to affect globally the vector
and be equals to each other - i.e, if either (or all) coordinates of the
real vector are equal to Double.NaN
, the real vector is equal to
a vector with all Double.NaN
coordinates.
equals
in class java.lang.Object
other
- Object to test for equality to thispublic int hashCode()
All NaN values have the same hash code.
hashCode
in class java.lang.Object
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"