Class DenseDoubleVector
- java.lang.Object
-
- ai.libs.jaicore.math.linearalgebra.AbstractVector
-
- ai.libs.jaicore.math.linearalgebra.DenseDoubleVector
-
- All Implemented Interfaces:
org.api4.java.common.math.IVector
public class DenseDoubleVector extends AbstractVector
Dense vector implementation wrapping the MTJ implementation of a dense vector.
-
-
Constructor Summary
Constructors Constructor 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 Instance Methods Concrete Methods Modifier and Type Method Description void
addConstant(double constant)
void
addVector(double[] vectorAsArray)
void
addVector(org.api4.java.common.math.IVector vector)
double[]
asArray()
void
divideByConstant(double constant)
void
divideByVectorPairwise(double[] vectorAsArray)
void
divideByVectorPairwise(org.api4.java.common.math.IVector secondVector)
double
dotProduct(double[] vectorAsArray)
double
dotProduct(org.api4.java.common.math.IVector vector)
org.api4.java.common.math.IVector
duplicate()
void
fillRandomly()
double
getValue(int index)
boolean
isSparse()
org.api4.java.common.math.IVector
kroneckerProduct(double[] vectorAsArray)
int
length()
void
multiplyByConstant(double constant)
void
multiplyByVectorPairwise(double[] vectorAsArray)
void
multiplyByVectorPairwise(org.api4.java.common.math.IVector secondVector)
void
normalize()
void
setValue(int index, double value)
void
subtractConstant(double constant)
void
subtractVector(double[] vectorAsArray)
void
subtractVector(org.api4.java.common.math.IVector vector)
DenseDoubleVector
toDenseVector()
SparseDoubleVector
toSparseVector()
-
Methods inherited from class ai.libs.jaicore.math.linearalgebra.AbstractVector
addConstantToCopy, addVectorToCopy, addVectorToCopy, average, divideByConstantToCopy, divideByVectorPairwiseToCopy, divideByVectorPairwiseToCopy, equals, euclideanNorm, hashCode, incrementValueAt, kroneckerProductInternal, mean, multiplyByConstantToCopy, multiplyByVectorPairwiseToCopy, multiplyByVectorPairwiseToCopy, squareRoot, squareRootToCopy, standardDeviation, subtractConstantFromCopy, subtractVectorFromCopy, subtractVectorFromCopy, sum, toString, zeroAllDimensions
-
-
-
-
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()
-
getValue
public double getValue(int index)
-
setValue
public void setValue(int index, double value)
-
addConstant
public void addConstant(double constant)
-
addVector
public void addVector(org.api4.java.common.math.IVector vector)
-
subtractConstant
public void subtractConstant(double constant)
-
subtractVector
public void subtractVector(org.api4.java.common.math.IVector vector)
-
multiplyByVectorPairwise
public void multiplyByVectorPairwise(org.api4.java.common.math.IVector secondVector)
-
multiplyByConstant
public void multiplyByConstant(double constant)
-
divideByVectorPairwise
public void divideByVectorPairwise(org.api4.java.common.math.IVector secondVector)
-
divideByConstant
public void divideByConstant(double constant)
-
dotProduct
public double dotProduct(org.api4.java.common.math.IVector vector)
-
isSparse
public boolean isSparse()
-
asArray
public double[] asArray()
-
addVector
public void addVector(double[] vectorAsArray)
-
subtractVector
public void subtractVector(double[] vectorAsArray)
-
multiplyByVectorPairwise
public void multiplyByVectorPairwise(double[] vectorAsArray)
-
divideByVectorPairwise
public void divideByVectorPairwise(double[] vectorAsArray)
-
dotProduct
public double dotProduct(double[] vectorAsArray)
-
duplicate
public org.api4.java.common.math.IVector duplicate()
-
normalize
public void normalize()
-
fillRandomly
public void fillRandomly()
-
toDenseVector
public DenseDoubleVector toDenseVector()
- Specified by:
toDenseVector
in classAbstractVector
-
toSparseVector
public SparseDoubleVector toSparseVector()
- Specified by:
toSparseVector
in classAbstractVector
-
kroneckerProduct
public org.api4.java.common.math.IVector kroneckerProduct(double[] vectorAsArray)
-
-