public interface Vector
| Modifier and Type | Method and Description |
|---|---|
void |
addConstant(double constant)
Adds the given constant to this vector.
|
Vector |
addConstantToCopy(double constant)
Adds the given constant to a copy of this vector and returns the result of
this operation.
|
void |
addVector(double[] vectorAsArray)
Adds the given double array interpreted as a vector to this vector.
|
void |
addVector(Vector vector)
Adds the given vector to this vector.
|
Vector |
addVectorToCopy(double[] vectorAsArray)
Adds the given double array interpreted as a vector to a copy of this vector
and returns the result of the operation.
|
Vector |
addVectorToCopy(Vector vector)
Adds the given vector to a copy of this vector and returns the result of the
operation.
|
double[] |
asArray()
Returns this vector as a double array.
|
java.lang.Double |
average()
Returns the average of all values contained in this vector.
|
void |
divideByConstant(double constant)
Divides this vector by the given constant.
|
Vector |
divideByConstantToCopy(double constant)
Divides a copy of this vector by the given constant and returns the result of
this operation.
|
void |
divideByVectorPairwise(double[] vectorAsArray)
Divides this vector by the given double array interpreted as a pairwise
vector and stores the result in this vector.
|
void |
divideByVectorPairwise(Vector vector)
Divides this vector by the given pairwise vector and stores the result in
this vector.
|
Vector |
divideByVectorPairwiseToCopy(double[] vectorAsArray)
Divides a copy of this vector by the given double array interpreted as a
pairwise vector and returns the result of this operation.
|
Vector |
divideByVectorPairwiseToCopy(Vector vector)
Divides a copy of this vector by the given pairwise vector and returns the
result of this operation.
|
double |
dotProduct(double[] vectorAsArray)
Computes the dot product of the given vector and this vector.
|
double |
dotProduct(Vector vector)
Computes the dot product of the given vector and this vector.
|
Vector |
duplicate()
Creates a deep copy of this vector.
|
double |
euclideanNorm()
Returns the Euclidean norm (length) of this vector.
|
void |
fillRandomly()
Fills this vector with random values from the unit interval.
|
double |
getValue(int index)
Returns the value at the given index of this vector.
|
void |
incrementValueAt(int index,
double amount)
Increments the value at the given index by the given amount.
|
boolean |
isSparse()
Checks if this vector is sparse.
|
Vector |
kroneckerProduct(double[] vectorAsArray)
Computes the kronecker product of this vector (v) with the given vector (w).
|
int |
length()
Returns the number of dimensions of this vector.
|
double |
mean()
Computes the mean of this vector.
|
static Vector |
merge(Vector v1,
Vector v2) |
void |
multiplyByConstant(double constant)
Multiplies this vector with the given constant.
|
Vector |
multiplyByConstantToCopy(double constant)
Multiplies a copy of this vector with the given constant and returns the
result of this operation.
|
void |
multiplyByVectorPairwise(double[] vectorAsArray)
Multiplies this vector with the given double array interpreted as a pairwise
vector and stores the result in this vector.
|
void |
multiplyByVectorPairwise(Vector vector)
Multiplies this vector with the given vector pairwisely and stores the result
in this vector.
|
Vector |
multiplyByVectorPairwiseToCopy(double[] vectorAsArray)
Multiplies a copy of this vector with the given double array interpreted as a
pairwise vector and returns the result of the operation.
|
Vector |
multiplyByVectorPairwiseToCopy(Vector vector)
Multiplies a copy of this vector with the given vector pairwisely and returns
the result of this operation.
|
void |
normalize()
Normalizes this vector to the unit interval.
|
void |
setValue(int index,
double value)
Sets the value at the given index of this vector to the given value.
|
void |
squareRoot()
Replaces the current values of the vectors with the square roots of the
elements.
|
Vector |
squareRootToCopy()
Takes the square root of each element of the vector and creates a new vector
with these elements.
|
double |
standardDeviation()
Returns the standard deviation over the values in the vector.
|
default java.util.stream.DoubleStream |
stream()
Returns a Stream of the values contained in this vector.
|
void |
subtractConstant(double constant)
Subtracts the given constant from this vector.
|
Vector |
subtractConstantFromCopy(double constant)
Subtracts the given constant from a copy of this vector and returns the
result of the operation.
|
void |
subtractVector(double[] vectorAsArray)
Subtracts the given double array interpreted as a vector from this vector.
|
void |
subtractVector(Vector vector)
Subtracts the given vector from this vector.
|
Vector |
subtractVectorFromCopy(double[] vectorAsArray)
Subtracts the given double array interpreted as a vector from a copy of this
vector and returns the result of this operation.
|
Vector |
subtractVectorFromCopy(Vector vector)
Subtracts the given vector from a copy of this vector and returns the result
of this operation.
|
double |
sum()
Returns the sum over the values of the dimensions of this vector.
|
DenseDoubleVector |
toDenseVector()
Returns this vector as
DenseDoubleVector. |
SparseDoubleVector |
toSparseVector()
Returns this vector as
SparseDoubleVector. |
void |
zeroAllDimensions()
Sets all dimensions of this vector to
0. |
void addVector(double[] vectorAsArray)
vectorAsArray - The vector to be added as array.Vector addVectorToCopy(double[] vectorAsArray)
vectorAsArray - The vector to be added as an array.void subtractVector(double[] vectorAsArray)
vectorAsArray - The vector to be subtracted as an array.Vector subtractVectorFromCopy(double[] vectorAsArray)
vectorAsArray - The vector to be subtracted as an array.void multiplyByVectorPairwise(double[] vectorAsArray)
vectorAsArray - The vector to be multiplied with.Vector multiplyByVectorPairwiseToCopy(double[] vectorAsArray)
vectorAsArray - The vector to be multiplied with.Vector kroneckerProduct(double[] vectorAsArray)
vectorAsArray - the vector to perform the kronecker product with. i.e. the
right-hand operandvoid divideByVectorPairwise(double[] vectorAsArray)
vectorAsArray - The vector to be divided by.Vector divideByVectorPairwiseToCopy(double[] vectorAsArray)
vectorAsArray - The operand vector as a double array.double dotProduct(double[] vectorAsArray)
vectorAsArray - The vector to compute dot product with.int length()
double getValue(int index)
index - The index of the value to look for.void setValue(int index,
double value)
index - The index to set the value at.value - The value to be set at the specified index.void addConstant(double constant)
constant - The constant to be added.Vector addConstantToCopy(double constant)
constant - The constant to be added.void addVector(Vector vector)
vector - The vector to be added to this vector.Vector addVectorToCopy(Vector vector)
vector - The vector to be added to this vector.void subtractConstant(double constant)
constant - The constant to be subtracted.Vector subtractConstantFromCopy(double constant)
constant - The constant to be subtracted.void subtractVector(Vector vector)
vector - The vector to subtract from this vector.Vector subtractVectorFromCopy(Vector vector)
vector - The vector to subtract from this vector.void multiplyByVectorPairwise(Vector vector)
vector - The vector to be multiplied with.Vector multiplyByVectorPairwiseToCopy(Vector vector)
vector - The vector to be multiplied with.void multiplyByConstant(double constant)
constant - The constant to multiply this vector with.Vector multiplyByConstantToCopy(double constant)
constant - The constant to multiply this vector with.void divideByVectorPairwise(Vector vector)
vector - The vector to be divided by.Vector divideByVectorPairwiseToCopy(Vector vector)
vector - The vector to be divided by.void divideByConstant(double constant)
constant - The constant to divide this vector by.Vector divideByConstantToCopy(double constant)
constant - The constant to divide this vector by.double dotProduct(Vector vector)
vector - The vector to compute dot product with.void squareRoot()
Vector squareRootToCopy()
boolean isSparse()
true, if this vector is sparse, false if not.double[] asArray()
DenseDoubleVector toDenseVector()
DenseDoubleVector.SparseDoubleVector toSparseVector()
SparseDoubleVector.Vector duplicate()
void normalize()
void incrementValueAt(int index,
double amount)
index - The index of the value to be incremented.amount - The amount to add to the value at the given index.double sum()
double mean()
double standardDeviation()
void zeroAllDimensions()
0.void fillRandomly()
double euclideanNorm()
java.lang.Double average()
default java.util.stream.DoubleStream stream()
Arrays.stream(double[]) with the double
representation of this vector.