|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.linear.OpenMapRealVector
public class OpenMapRealVector
This class implements the RealVector
interface with a OpenIntToDoubleHashMap
backing store.
Field Summary | |
---|---|
static double |
DEFAULT_ZERO_TOLERANCE
Default Tolerance for having a value considered zero. |
private OpenIntToDoubleHashMap |
entries
Entries of the vector. |
private double |
epsilon
Tolerance for having a value considered zero. |
private static long |
serialVersionUID
Serializable version identifier. |
private int |
virtualSize
Dimension of the vector. |
Constructor Summary | |
---|---|
|
OpenMapRealVector()
Build a 0-length vector. |
|
OpenMapRealVector(double[] values)
Create from a double array. |
|
OpenMapRealVector(java.lang.Double[] values)
Create from a Double array. |
|
OpenMapRealVector(double[] values,
double epsilon)
Create from a double array, specifying zero tolerance. |
|
OpenMapRealVector(java.lang.Double[] values,
double epsilon)
Create from a Double array. |
|
OpenMapRealVector(int dimension)
Construct a (dimension)-length vector of zeros. |
|
OpenMapRealVector(int dimension,
double epsilon)
Construct a (dimension)-length vector of zeros, specifying zero tolerance. |
|
OpenMapRealVector(int dimension,
int expectedSize)
Build a vector with known the sparseness (for advanced use only). |
|
OpenMapRealVector(int dimension,
int expectedSize,
double epsilon)
Build a vector with known the sparseness and zero tolerance setting (for advanced use only). |
|
OpenMapRealVector(OpenMapRealVector v)
Copy constructor. |
protected |
OpenMapRealVector(OpenMapRealVector v,
int resize)
Build a resized vector, for use with append. |
|
OpenMapRealVector(RealVector v)
Generic copy constructor. |
Method Summary | |
---|---|
OpenMapRealVector |
add(double[] v)
Compute the sum of this and v. |
OpenMapRealVector |
add(OpenMapRealVector v)
Optimized method to add two OpenMapRealVectors. |
OpenMapRealVector |
add(RealVector v)
Compute the sum of this and v. |
OpenMapRealVector |
append(double d)
Construct a vector by appending a double to this vector. |
OpenMapRealVector |
append(double[] a)
Construct a vector by appending a double array to this vector. |
OpenMapRealVector |
append(OpenMapRealVector v)
Optimized method to append a OpenMapRealVector. |
OpenMapRealVector |
append(RealVector v)
Construct a vector by appending a vector to this vector. |
private void |
checkIndex(int index)
Check if an index is valid. |
protected void |
checkVectorDimensions(int n)
Check if instance dimension is equal to some expected value. |
OpenMapRealVector |
copy()
Returns a (deep) copy of this. |
double |
dotProduct(double[] v)
Compute the dot product. |
double |
dotProduct(RealVector v)
Compute the dot product. |
OpenMapRealVector |
ebeDivide(double[] v)
Element-by-element division. |
OpenMapRealVector |
ebeDivide(RealVector v)
Element-by-element division. |
OpenMapRealVector |
ebeMultiply(double[] v)
Element-by-element multiplication. |
OpenMapRealVector |
ebeMultiply(RealVector v)
Element-by-element multiplication. |
boolean |
equals(java.lang.Object obj)
Implementation Note: This performs an exact comparison, and as a result it is possible for a.subtract(b } to be the zero vector, while
a.equals(b) == false . |
double[] |
getData()
Returns vector entries as a double array. |
int |
getDimension()
Returns the size of the vector. |
double |
getDistance(double[] v)
Distance between two vectors. |
double |
getDistance(OpenMapRealVector v)
Optimized method to compute distance. |
double |
getDistance(RealVector v)
Distance between two vectors. |
private OpenIntToDoubleHashMap |
getEntries()
Get the entries of this instance. |
double |
getEntry(int index)
Returns the entry in the specified index. |
double |
getEpsilon()
Get the tolerance for having a value considered zero. |
double |
getL1Distance(double[] v)
Distance between two vectors. |
double |
getL1Distance(OpenMapRealVector v)
Distance between two vectors. |
double |
getL1Distance(RealVector v)
Distance between two vectors. |
double |
getL1Norm()
Returns the L1 norm of the vector. |
double |
getLInfDistance(double[] v)
Distance between two vectors. |
private double |
getLInfDistance(OpenMapRealVector v)
Optimized method to compute LInfDistance. |
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. |
double |
getSparcity()
|
OpenMapRealVector |
getSubVector(int index,
int n)
Get a subvector from consecutive elements. |
int |
hashCode()
|
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 |
protected boolean |
isZero(double value)
Determine if this value is zero. |
OpenMapRealVector |
mapAbs()
Map the Math.abs(double) function to each entry. |
OpenMapRealVector |
mapAbsToSelf()
Map the Math.abs(double) function to each entry. |
OpenMapRealVector |
mapAcos()
Map the Math.acos(double) function to each entry. |
OpenMapRealVector |
mapAcosToSelf()
Map the Math.acos(double) function to each entry. |
OpenMapRealVector |
mapAdd(double d)
Map an addition operation to each entry. |
OpenMapRealVector |
mapAddToSelf(double d)
Map an addition operation to each entry. |
OpenMapRealVector |
mapAsin()
Map the Math.asin(double) function to each entry. |
OpenMapRealVector |
mapAsinToSelf()
Map the Math.asin(double) function to each entry. |
OpenMapRealVector |
mapAtan()
Map the Math.atan(double) function to each entry. |
OpenMapRealVector |
mapAtanToSelf()
Map the Math.atan(double) function to each entry. |
OpenMapRealVector |
mapCbrt()
Map the Math.cbrt(double) function to each entry. |
OpenMapRealVector |
mapCbrtToSelf()
Map the Math.cbrt(double) function to each entry. |
OpenMapRealVector |
mapCeil()
Map the Math.ceil(double) function to each entry. |
OpenMapRealVector |
mapCeilToSelf()
Map the Math.ceil(double) function to each entry. |
OpenMapRealVector |
mapCos()
Map the Math.cos(double) function to each entry. |
OpenMapRealVector |
mapCosh()
Map the Math.cosh(double) function to each entry. |
OpenMapRealVector |
mapCoshToSelf()
Map the Math.cosh(double) function to each entry. |
OpenMapRealVector |
mapCosToSelf()
Map the Math.cos(double) function to each entry. |
OpenMapRealVector |
mapDivide(double d)
Map a division operation to each entry. |
OpenMapRealVector |
mapDivideToSelf(double d)
Map a division operation to each entry. |
OpenMapRealVector |
mapExp()
Map the Math.exp(double) function to each entry. |
OpenMapRealVector |
mapExpm1()
Map the Math.expm1(double) function to each entry. |
OpenMapRealVector |
mapExpm1ToSelf()
Map the Math.expm1(double) function to each entry. |
OpenMapRealVector |
mapExpToSelf()
Map the Math.exp(double) function to each entry. |
OpenMapRealVector |
mapFloor()
Map the Math.floor(double) function to each entry. |
OpenMapRealVector |
mapFloorToSelf()
Map the Math.floor(double) function to each entry. |
OpenMapRealVector |
mapInv()
Map the 1/x function to each entry. |
OpenMapRealVector |
mapInvToSelf()
Map the 1/x function to each entry. |
OpenMapRealVector |
mapLog()
Map the Math.log(double) function to each entry. |
OpenMapRealVector |
mapLog10()
Map the Math.log10(double) function to each entry. |
OpenMapRealVector |
mapLog10ToSelf()
Map the Math.log10(double) function to each entry. |
OpenMapRealVector |
mapLog1p()
Map the Math.log1p(double) function to each entry. |
OpenMapRealVector |
mapLog1pToSelf()
Map the Math.log1p(double) function to each entry. |
OpenMapRealVector |
mapLogToSelf()
Map the Math.log(double) function to each entry. |
OpenMapRealVector |
mapMultiply(double d)
Map a multiplication operation to each entry. |
OpenMapRealVector |
mapMultiplyToSelf(double d)
Map a multiplication operation to each entry. |
OpenMapRealVector |
mapPow(double d)
Map a power operation to each entry. |
OpenMapRealVector |
mapPowToSelf(double d)
Map a power operation to each entry. |
OpenMapRealVector |
mapRint()
Map the Math.rint(double) function to each entry. |
OpenMapRealVector |
mapRintToSelf()
Map the Math.rint(double) function to each entry. |
OpenMapRealVector |
mapSignum()
Map the Math.signum(double) function to each entry. |
OpenMapRealVector |
mapSignumToSelf()
Map the Math.signum(double) function to each entry. |
OpenMapRealVector |
mapSin()
Map the Math.sin(double) function to each entry. |
OpenMapRealVector |
mapSinh()
Map the Math.sinh(double) function to each entry. |
OpenMapRealVector |
mapSinhToSelf()
Map the Math.sinh(double) function to each entry. |
OpenMapRealVector |
mapSinToSelf()
Map the Math.sin(double) function to each entry. |
OpenMapRealVector |
mapSqrt()
Map the Math.sqrt(double) function to each entry. |
OpenMapRealVector |
mapSqrtToSelf()
Map the Math.sqrt(double) function to each entry. |
OpenMapRealVector |
mapSubtract(double d)
Map a subtraction operation to each entry. |
OpenMapRealVector |
mapSubtractToSelf(double d)
Map a subtraction operation to each entry. |
OpenMapRealVector |
mapTan()
Map the Math.tan(double) function to each entry. |
OpenMapRealVector |
mapTanh()
Map the Math.tanh(double) function to each entry. |
OpenMapRealVector |
mapTanhToSelf()
Map the Math.tanh(double) function to each entry. |
OpenMapRealVector |
mapTanToSelf()
Map the Math.tan(double) function to each entry. |
OpenMapRealVector |
mapUlp()
Map the Math.ulp(double) function to each entry. |
OpenMapRealVector |
mapUlpToSelf()
Map the Math.ulp(double) function to each entry. |
RealMatrix |
outerProduct(double[] v)
Compute the outer product. |
OpenMapRealMatrix |
outerproduct(OpenMapRealVector v)
Optimized method to compute the outer product. |
RealMatrix |
outerProduct(RealVector v)
Compute the outer product. |
OpenMapRealVector |
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 |
setEntry(int index,
double value)
Set a single element. |
void |
setEpsilon(double epsilon)
Set the tolerance for having a value considered zero. |
void |
setSubVector(int index,
double[] v)
Set a set of consecutive elements. |
void |
setSubVector(int index,
RealVector v)
Set a set of consecutive elements. |
OpenMapRealVector |
subtract(double[] v)
Compute this minus v. |
OpenMapRealVector |
subtract(OpenMapRealVector v)
Optimized method to subtract OpenMapRealVectors. |
OpenMapRealVector |
subtract(RealVector v)
Compute this minus v. |
double[] |
toArray()
Convert the vector to a double array. |
void |
unitize()
Converts this vector into a unit vector. |
OpenMapRealVector |
unitVector()
Creates a unit vector pointing in the direction of this vector. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final double DEFAULT_ZERO_TOLERANCE
private final OpenIntToDoubleHashMap entries
private final int virtualSize
private double epsilon
Constructor Detail |
---|
public OpenMapRealVector()
Zero-length vectors may be used to initialized construction of vectors
by data gathering. We start with zero-length and use either the OpenMapRealVector(OpenMapRealVector, int)
constructor
or one of the append
method (append(double)
, append(double[])
, append(RealVector)
) to gather data
into this vector.
public OpenMapRealVector(int dimension)
dimension
- size of the vectorpublic OpenMapRealVector(int dimension, double epsilon)
dimension
- Size of the vectorepsilon
- The tolerance for having a value considered zeroprotected OpenMapRealVector(OpenMapRealVector v, int resize)
v
- The original vectorresize
- The amount to resize itpublic OpenMapRealVector(int dimension, int expectedSize)
dimension
- The size of the vectorexpectedSize
- The expected number of non-zero entriespublic OpenMapRealVector(int dimension, int expectedSize, double epsilon)
dimension
- The size of the vectorexpectedSize
- The expected number of non-zero entriesepsilon
- The tolerance for having a value considered zeropublic OpenMapRealVector(double[] values)
values
- The set of values to create frompublic OpenMapRealVector(double[] values, double epsilon)
values
- The set of values to create fromepsilon
- The tolerance for having a value considered zeropublic OpenMapRealVector(java.lang.Double[] values)
values
- The set of values to create frompublic OpenMapRealVector(java.lang.Double[] values, double epsilon)
values
- The set of values to create fromepsilon
- The tolerance for having a value considered zeropublic OpenMapRealVector(OpenMapRealVector v)
v
- The instance to copy frompublic OpenMapRealVector(RealVector v)
v
- The instance to copy fromMethod Detail |
---|
private OpenIntToDoubleHashMap getEntries()
protected boolean isZero(double value)
value
- The value to test
true
if this value is zero, false
otherwisepublic double getEpsilon()
public void setEpsilon(double epsilon)
epsilon
- The test range for testing if a value is zeropublic OpenMapRealVector add(RealVector v) throws java.lang.IllegalArgumentException
add
in interface RealVector
v
- vector to be added
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector add(OpenMapRealVector v) throws java.lang.IllegalArgumentException
v
- Vector to add with
this
with v
java.lang.IllegalArgumentException
- If the dimensions don't matchpublic OpenMapRealVector add(double[] v) throws java.lang.IllegalArgumentException
add
in interface RealVector
v
- vector to be added
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector append(OpenMapRealVector v)
v
- vector to append
v
to selfpublic OpenMapRealVector append(RealVector v)
append
in interface RealVector
v
- vector to append to this one.
public OpenMapRealVector append(double d)
append
in interface RealVector
d
- double to append.
public OpenMapRealVector append(double[] a)
append
in interface RealVector
a
- double array to append.
public OpenMapRealVector copy()
copy
in interface RealVector
public double dotProduct(RealVector v) throws java.lang.IllegalArgumentException
dotProduct
in interface RealVector
v
- vector with which dot product should be computed
java.lang.IllegalArgumentException
- if v is not the same size as thispublic double dotProduct(double[] v) throws java.lang.IllegalArgumentException
dotProduct
in interface RealVector
v
- vector with which dot product should be computed
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector ebeDivide(RealVector v) throws java.lang.IllegalArgumentException
ebeDivide
in interface RealVector
v
- vector by which instance elements must be divided
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector ebeDivide(double[] v) throws java.lang.IllegalArgumentException
ebeDivide
in interface RealVector
v
- vector by which instance elements must be divided
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector ebeMultiply(RealVector v) throws java.lang.IllegalArgumentException
ebeMultiply
in interface RealVector
v
- vector by which instance elements must be multiplied
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector ebeMultiply(double[] v) throws java.lang.IllegalArgumentException
ebeMultiply
in interface RealVector
v
- vector by which instance elements must be multiplied
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector getSubVector(int index, int n) throws MatrixIndexException
getSubVector
in interface RealVector
index
- index of first element.n
- number of elements to be retrieved.
MatrixIndexException
- if the index is
inconsistent with vector sizepublic double[] getData()
getData
in interface RealVector
public int getDimension()
getDimension
in interface RealVector
public double getDistance(OpenMapRealVector v) throws java.lang.IllegalArgumentException
v
- The vector to compute distance to
this
and v
java.lang.IllegalArgumentException
- If the dimensions don't matchpublic 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
v
- vector to which distance is requested
java.lang.IllegalArgumentException
- if v is not the same size as thisRealVector.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
v
- vector to which distance is requested
java.lang.IllegalArgumentException
- if v is not the same size as thisRealVector.getL1Distance(double[])
,
RealVector.getLInfDistance(double[])
,
RealVector.getNorm()
public double getEntry(int index) throws MatrixIndexException
The index start at 0 and must be lesser than the size,
otherwise a MatrixIndexException
is thrown.
getEntry
in interface RealVector
index
- index location of entry to be fetched
MatrixIndexException
- if the index is not validRealVector.setEntry(int, double)
public double getL1Distance(OpenMapRealVector v)
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 requested
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
v
- vector to which distance is requested
java.lang.IllegalArgumentException
- if v is not the same size as thisRealVector.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
v
- vector to which distance is requested
java.lang.IllegalArgumentException
- if v is not the same size as thisRealVector.getDistance(double[])
,
RealVector.getLInfDistance(double[])
,
RealVector.getL1Norm()
public double getL1Norm()
The L1 norm is the sum of the absolute values of elements.
getL1Norm
in interface RealVector
RealVector.getNorm()
,
RealVector.getLInfNorm()
,
RealVector.getL1Distance(RealVector)
private double getLInfDistance(OpenMapRealVector v)
v
- The vector to compute from
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
v
- vector to which distance is requested
java.lang.IllegalArgumentException
- if v is not the same size as thisRealVector.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
v
- vector to which distance is requested
java.lang.IllegalArgumentException
- if v is not the same size as thisRealVector.getDistance(double[])
,
RealVector.getL1Distance(double[])
,
RealVector.getLInfNorm()
public double getLInfNorm()
The L∞ norm is the max of the absolute values of elements.
getLInfNorm
in interface RealVector
RealVector.getNorm()
,
RealVector.getL1Norm()
,
RealVector.getLInfDistance(RealVector)
public double getNorm()
The L2 norm is the root of the sum of the squared elements.
getNorm
in interface RealVector
RealVector.getL1Norm()
,
RealVector.getLInfNorm()
,
RealVector.getDistance(RealVector)
public boolean isInfinite()
isInfinite
in interface RealVector
public boolean isNaN()
isNaN
in interface RealVector
public OpenMapRealVector mapAbs()
Math.abs(double)
function to each entry.
mapAbs
in interface RealVector
public OpenMapRealVector mapAbsToSelf()
Math.abs(double)
function to each entry.
The instance is changed by this method.
mapAbsToSelf
in interface RealVector
public OpenMapRealVector mapAcos()
Math.acos(double)
function to each entry.
mapAcos
in interface RealVector
public OpenMapRealVector mapAcosToSelf()
Math.acos(double)
function to each entry.
The instance is changed by this method.
mapAcosToSelf
in interface RealVector
public OpenMapRealVector mapAdd(double d)
mapAdd
in interface RealVector
d
- value to be added to each entry
public OpenMapRealVector mapAddToSelf(double d)
The instance is changed by this method.
mapAddToSelf
in interface RealVector
d
- value to be added to each entry
public OpenMapRealVector mapAsin()
Math.asin(double)
function to each entry.
mapAsin
in interface RealVector
public OpenMapRealVector mapAsinToSelf()
Math.asin(double)
function to each entry.
The instance is changed by this method.
mapAsinToSelf
in interface RealVector
public OpenMapRealVector mapAtan()
Math.atan(double)
function to each entry.
mapAtan
in interface RealVector
public OpenMapRealVector mapAtanToSelf()
Math.atan(double)
function to each entry.
The instance is changed by this method.
mapAtanToSelf
in interface RealVector
public OpenMapRealVector mapCbrt()
Math.cbrt(double)
function to each entry.
mapCbrt
in interface RealVector
public OpenMapRealVector mapCbrtToSelf()
Math.cbrt(double)
function to each entry.
The instance is changed by this method.
mapCbrtToSelf
in interface RealVector
public OpenMapRealVector mapCeil()
Math.ceil(double)
function to each entry.
mapCeil
in interface RealVector
public OpenMapRealVector mapCeilToSelf()
Math.ceil(double)
function to each entry.
The instance is changed by this method.
mapCeilToSelf
in interface RealVector
public OpenMapRealVector mapCos()
Math.cos(double)
function to each entry.
mapCos
in interface RealVector
public OpenMapRealVector mapCosToSelf()
Math.cos(double)
function to each entry.
The instance is changed by this method.
mapCosToSelf
in interface RealVector
public OpenMapRealVector mapCosh()
Math.cosh(double)
function to each entry.
mapCosh
in interface RealVector
public OpenMapRealVector mapCoshToSelf()
Math.cosh(double)
function to each entry.
The instance is changed by this method.
mapCoshToSelf
in interface RealVector
public OpenMapRealVector mapDivide(double d)
mapDivide
in interface RealVector
d
- value to divide all entries by
public OpenMapRealVector mapDivideToSelf(double d)
The instance is changed by this method.
mapDivideToSelf
in interface RealVector
d
- value to divide all entries by
public OpenMapRealVector mapExp()
Math.exp(double)
function to each entry.
mapExp
in interface RealVector
public OpenMapRealVector mapExpToSelf()
Math.exp(double)
function to each entry.
The instance is changed by this method.
mapExpToSelf
in interface RealVector
public OpenMapRealVector mapExpm1()
Math.expm1(double)
function to each entry.
mapExpm1
in interface RealVector
public OpenMapRealVector mapExpm1ToSelf()
Math.expm1(double)
function to each entry.
The instance is changed by this method.
mapExpm1ToSelf
in interface RealVector
public OpenMapRealVector mapFloor()
Math.floor(double)
function to each entry.
mapFloor
in interface RealVector
public OpenMapRealVector mapFloorToSelf()
Math.floor(double)
function to each entry.
The instance is changed by this method.
mapFloorToSelf
in interface RealVector
public OpenMapRealVector mapInv()
mapInv
in interface RealVector
public OpenMapRealVector mapInvToSelf()
The instance is changed by this method.
mapInvToSelf
in interface RealVector
public OpenMapRealVector mapLog()
Math.log(double)
function to each entry.
mapLog
in interface RealVector
public OpenMapRealVector mapLog10()
Math.log10(double)
function to each entry.
mapLog10
in interface RealVector
public OpenMapRealVector mapLog10ToSelf()
Math.log10(double)
function to each entry.
The instance is changed by this method.
mapLog10ToSelf
in interface RealVector
public OpenMapRealVector mapLog1p()
Math.log1p(double)
function to each entry.
mapLog1p
in interface RealVector
public OpenMapRealVector mapLog1pToSelf()
Math.log1p(double)
function to each entry.
The instance is changed by this method.
mapLog1pToSelf
in interface RealVector
public OpenMapRealVector mapLogToSelf()
Math.log(double)
function to each entry.
The instance is changed by this method.
mapLogToSelf
in interface RealVector
public OpenMapRealVector mapMultiply(double d)
mapMultiply
in interface RealVector
d
- value to multiply all entries by
public OpenMapRealVector mapMultiplyToSelf(double d)
The instance is changed by this method.
mapMultiplyToSelf
in interface RealVector
d
- value to multiply all entries by
public OpenMapRealVector mapPow(double d)
mapPow
in interface RealVector
d
- value to raise all entries to
public OpenMapRealVector mapPowToSelf(double d)
The instance is changed by this method.
mapPowToSelf
in interface RealVector
d
- value to raise all entries to
public OpenMapRealVector mapRint()
Math.rint(double)
function to each entry.
mapRint
in interface RealVector
public OpenMapRealVector mapRintToSelf()
Math.rint(double)
function to each entry.
The instance is changed by this method.
mapRintToSelf
in interface RealVector
public OpenMapRealVector mapSignum()
Math.signum(double)
function to each entry.
mapSignum
in interface RealVector
public OpenMapRealVector mapSignumToSelf()
Math.signum(double)
function to each entry.
The instance is changed by this method.
mapSignumToSelf
in interface RealVector
public OpenMapRealVector mapSin()
Math.sin(double)
function to each entry.
mapSin
in interface RealVector
public OpenMapRealVector mapSinToSelf()
Math.sin(double)
function to each entry.
The instance is changed by this method.
mapSinToSelf
in interface RealVector
public OpenMapRealVector mapSinh()
Math.sinh(double)
function to each entry.
mapSinh
in interface RealVector
public OpenMapRealVector mapSinhToSelf()
Math.sinh(double)
function to each entry.
The instance is changed by this method.
mapSinhToSelf
in interface RealVector
public OpenMapRealVector mapSqrt()
Math.sqrt(double)
function to each entry.
mapSqrt
in interface RealVector
public OpenMapRealVector mapSqrtToSelf()
Math.sqrt(double)
function to each entry.
The instance is changed by this method.
mapSqrtToSelf
in interface RealVector
public OpenMapRealVector mapSubtract(double d)
mapSubtract
in interface RealVector
d
- value to be subtracted to each entry
public OpenMapRealVector mapSubtractToSelf(double d)
The instance is changed by this method.
mapSubtractToSelf
in interface RealVector
d
- value to be subtracted to each entry
public OpenMapRealVector mapTan()
Math.tan(double)
function to each entry.
mapTan
in interface RealVector
public OpenMapRealVector mapTanToSelf()
Math.tan(double)
function to each entry.
The instance is changed by this method.
mapTanToSelf
in interface RealVector
public OpenMapRealVector mapTanh()
Math.tanh(double)
function to each entry.
mapTanh
in interface RealVector
public OpenMapRealVector mapTanhToSelf()
Math.tanh(double)
function to each entry.
The instance is changed by this method.
mapTanhToSelf
in interface RealVector
public OpenMapRealVector mapUlp()
Math.ulp(double)
function to each entry.
mapUlp
in interface RealVector
public OpenMapRealVector mapUlpToSelf()
Math.ulp(double)
function to each entry.
The instance is changed by this method.
mapUlpToSelf
in interface RealVector
public OpenMapRealMatrix outerproduct(OpenMapRealVector v) throws java.lang.IllegalArgumentException
v
- The vector to comput the outer product on
this
and v
java.lang.IllegalArgumentException
- If the dimensions don't matchpublic RealMatrix outerProduct(RealVector v) throws java.lang.IllegalArgumentException
outerProduct
in interface RealVector
v
- vector with which outer product should be computed
java.lang.IllegalArgumentException
- if v is not the same size as thispublic RealMatrix outerProduct(double[] v) throws java.lang.IllegalArgumentException
outerProduct
in interface RealVector
v
- vector with which outer product should be computed
java.lang.IllegalArgumentException
- if v is not the same size as thispublic RealVector projection(RealVector v) throws java.lang.IllegalArgumentException
projection
in interface RealVector
v
- vector onto which instance must be projected
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector projection(double[] v) throws java.lang.IllegalArgumentException
projection
in interface RealVector
v
- vector onto which instance must be projected
java.lang.IllegalArgumentException
- if v is not the same size as thispublic void setEntry(int index, double value) throws MatrixIndexException
setEntry
in interface RealVector
index
- element index.value
- new value for the element.
MatrixIndexException
- if the index is
inconsistent with vector sizeRealVector.getEntry(int)
public void setSubVector(int index, RealVector v) throws MatrixIndexException
setSubVector
in interface RealVector
index
- index of first element to be set.v
- vector containing the values to set.
MatrixIndexException
- if the index is
inconsistent with vector sizeRealVector.setSubVector(int, double[])
public void setSubVector(int index, double[] v) throws MatrixIndexException
setSubVector
in interface RealVector
index
- index of first element to be set.v
- vector containing the values to set.
MatrixIndexException
- if the index is
inconsistent with vector sizeRealVector.setSubVector(int, RealVector)
public void set(double value)
set
in interface RealVector
value
- single value to set for all elementspublic OpenMapRealVector subtract(OpenMapRealVector v) throws java.lang.IllegalArgumentException
v
- The vector to subtract from this
this
and v
java.lang.IllegalArgumentException
- If the dimensions don't matchpublic OpenMapRealVector subtract(RealVector v) throws java.lang.IllegalArgumentException
subtract
in interface RealVector
v
- vector to be subtracted
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector subtract(double[] v) throws java.lang.IllegalArgumentException
subtract
in interface RealVector
v
- vector to be subtracted
java.lang.IllegalArgumentException
- if v is not the same size as thispublic OpenMapRealVector unitVector()
The instance is not changed by this method.
unitVector
in interface RealVector
public void unitize()
The instance itself is changed by this method.
unitize
in interface RealVector
private void checkIndex(int index) throws MatrixIndexException
index
- index to check
MatrixIndexException
- if index is not validprotected void checkVectorDimensions(int n) throws java.lang.IllegalArgumentException
n
- expected dimension.
java.lang.IllegalArgumentException
- if the dimension is inconsistent with vector sizepublic double[] toArray()
The array is independent from vector data, it's elements are copied.
toArray
in interface RealVector
public int hashCode()
Implementation Note: This works on exact values, and as a result
it is possible for a.subtract(b)
to be the zero vector, while
a.hashCode() != b.hashCode()
.
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
Implementation Note: This performs an exact comparison, and as a result
it is possible for a.subtract(b
} to be the zero vector, while
a.equals(b) == false
.
equals
in class java.lang.Object
public double getSparcity()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |