ai.libs.jaicore.math.linearalgebra

## Class DenseDoubleVector

• All Implemented Interfaces:
Vector

`public class DenseDoubleVectorextends AbstractVector`
Dense vector implementation wrapping the MTJ implementation of a dense vector.
• ### Constructor Summary

Constructors
Constructor and Description
`DenseDoubleVector(double[] data)`
Creates a dense vector from the given data.
`DenseDoubleVector(int numberOfDimensions)`
Creates a dense vector with the given amount of dimensions, initialized with zeros.
`DenseDoubleVector(int size, double value)`
Creates a new dense vector with the given size and paste for each entry the given value.
`DenseDoubleVector(no.uib.cipr.matrix.Vector vector)`
Creates a dense vector from an MTJ vector.
• ### Method Summary

All Methods
Modifier and TypeMethod and Description
`void``addConstant(double constant)`
Adds the given constant to this vector.
`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.
`double[]``asArray()`
Returns this vector as a double array.
`void``divideByConstant(double constant)`
Divides this vector by the given constant.
`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 secondVector)`
Divides this vector by the given pairwise vector and stores the result in this vector.
`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.
`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.
`boolean``isSparse()`
Checks if this vector is sparse.
`int``length()`
Returns the number of dimensions of this vector.
`void``multiplyByConstant(double constant)`
Multiplies this vector with the given constant.
`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 secondVector)`
Multiplies this vector with the given vector pairwisely and stores the result in this vector.
`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``subtractConstant(double constant)`
Subtracts the given constant from this vector.
`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.
`DenseDoubleVector``toDenseVector()`
Returns this vector as `DenseDoubleVector`.
`SparseDoubleVector``toSparseVector()`
Returns this vector as `SparseDoubleVector`.
• ### Methods inherited from class ai.libs.jaicore.math.linearalgebra.AbstractVector

`addConstantToCopy, addVectorToCopy, addVectorToCopy, average, divideByConstantToCopy, divideByVectorPairwiseToCopy, divideByVectorPairwiseToCopy, equals, euclideanNorm, hashCode, incrementValueAt, mean, multiplyByConstantToCopy, multiplyByVectorPairwiseToCopy, multiplyByVectorPairwiseToCopy, squareRoot, squareRootToCopy, standardDeviation, subtractConstantFromCopy, subtractVectorFromCopy, subtractVectorFromCopy, sum, toString, zeroAllDimensions`
• ### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`
• ### Methods inherited from interface ai.libs.jaicore.math.linearalgebra.Vector

`merge`
• ### Constructor Detail

• #### DenseDoubleVector

`public DenseDoubleVector(int numberOfDimensions)`
Creates a dense vector with the given amount of dimensions, initialized with zeros.
Parameters:
`numberOfDimensions` - The number of dimensions of this vector.
• #### DenseDoubleVector

`public DenseDoubleVector(double[] data)`
Creates a dense vector from the given data.
Parameters:
`data` - A double array, which can be interpreted as a vector.
• #### DenseDoubleVector

`public DenseDoubleVector(no.uib.cipr.matrix.Vector vector)`
Creates a dense vector from an MTJ vector.
Parameters:
`vector` - The MTJ vector.
• #### DenseDoubleVector

`public DenseDoubleVector(int size,                         double value)`
Creates a new dense vector with the given size and paste for each entry the given value.
Parameters:
`size` - The size of the dense vector.
`value` - The value for each entry.
• ### Method Detail

• #### length

`public int length()`
Description copied from interface: `Vector`
Returns the number of dimensions of this vector.
Returns:
The number of dimensions of this vector.
• #### getValue

`public double getValue(int index)`
Description copied from interface: `Vector`
Returns the value at the given index of this vector.
Parameters:
`index` - The index of the value to look for.
Returns:
The value at the given index.
• #### setValue

`public void setValue(int index,                     double value)`
Description copied from interface: `Vector`
Sets the value at the given index of this vector to the given value.
Parameters:
`index` - The index to set the value at.
`value` - The value to be set at the specified index.

`public void addConstant(double constant)`
Description copied from interface: `Vector`
Adds the given constant to this vector.
Parameters:
`constant` - The constant to be added.

`public void addVector(Vector vector)`
Description copied from interface: `Vector`
Adds the given vector to this vector. The result is stored in this vector.
Parameters:
`vector` - The vector to be added to this vector.
• #### subtractConstant

`public void subtractConstant(double constant)`
Description copied from interface: `Vector`
Subtracts the given constant from this vector.
Parameters:
`constant` - The constant to be subtracted.
• #### subtractVector

`public void subtractVector(Vector vector)`
Description copied from interface: `Vector`
Subtracts the given vector from this vector. The result is stored in this vector.
Parameters:
`vector` - The vector to subtract from this vector.
• #### multiplyByVectorPairwise

`public void multiplyByVectorPairwise(Vector secondVector)`
Description copied from interface: `Vector`
Multiplies this vector with the given vector pairwisely and stores the result in this vector.
Parameters:
`secondVector` - The vector to be multiplied with.
• #### multiplyByConstant

`public void multiplyByConstant(double constant)`
Description copied from interface: `Vector`
Multiplies this vector with the given constant.
Parameters:
`constant` - The constant to multiply this vector with.
• #### divideByVectorPairwise

`public void divideByVectorPairwise(Vector secondVector)`
Description copied from interface: `Vector`
Divides this vector by the given pairwise vector and stores the result in this vector.
Parameters:
`secondVector` - The vector to be divided by.
• #### divideByConstant

`public void divideByConstant(double constant)`
Description copied from interface: `Vector`
Divides this vector by the given constant.
Parameters:
`constant` - The constant to divide this vector by.
• #### dotProduct

`public double dotProduct(Vector vector)`
Description copied from interface: `Vector`
Computes the dot product of the given vector and this vector.
Parameters:
`vector` - The vector to compute dot product with.
Returns:
The dot product of the given and this vector.
• #### isSparse

`public boolean isSparse()`
Description copied from interface: `Vector`
Checks if this vector is sparse.
Returns:
`true`, if this vector is sparse, `false` if not.
• #### asArray

`public double[] asArray()`
Description copied from interface: `Vector`
Returns this vector as a double array.
Returns:
The current vector as a double array.

`public void addVector(double[] vectorAsArray)`
Description copied from interface: `Vector`
Adds the given double array interpreted as a vector to this vector.
Parameters:
`vectorAsArray` - The vector to be added as array.
• #### subtractVector

`public void subtractVector(double[] vectorAsArray)`
Description copied from interface: `Vector`
Subtracts the given double array interpreted as a vector from this vector.
Parameters:
`vectorAsArray` - The vector to be subtracted as an array.
• #### multiplyByVectorPairwise

`public void multiplyByVectorPairwise(double[] vectorAsArray)`
Description copied from interface: `Vector`
Multiplies this vector with the given double array interpreted as a pairwise vector and stores the result in this vector.
Parameters:
`vectorAsArray` - The vector to be multiplied with.
• #### divideByVectorPairwise

`public void divideByVectorPairwise(double[] vectorAsArray)`
Description copied from interface: `Vector`
Divides this vector by the given double array interpreted as a pairwise vector and stores the result in this vector.
Parameters:
`vectorAsArray` - The vector to be divided by.
• #### dotProduct

`public double dotProduct(double[] vectorAsArray)`
Description copied from interface: `Vector`
Computes the dot product of the given vector and this vector.
Parameters:
`vectorAsArray` - The vector to compute dot product with.
Returns:
The dot product of the given and this vector.
• #### duplicate

`public Vector duplicate()`
Description copied from interface: `Vector`
Creates a deep copy of this vector.
Returns:
A deep copy of this vector.
• #### normalize

`public void normalize()`
Description copied from interface: `Vector`
Normalizes this vector to the unit interval.
• #### fillRandomly

`public void fillRandomly()`
Description copied from interface: `Vector`
Fills this vector with random values from the unit interval.
• #### toDenseVector

`public DenseDoubleVector toDenseVector()`
Description copied from interface: `Vector`
Returns this vector as `DenseDoubleVector`.
Returns:
The current vector as a dense vector.
• #### toSparseVector

`public SparseDoubleVector toSparseVector()`
Description copied from interface: `Vector`
Returns this vector as `SparseDoubleVector`.
Returns:
The current vector as a sparse vector.

NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14