Constructor and Description |
---|
VectorUtils() |
Modifier and Type | Method and Description |
---|---|
static Vector |
copyPart(Vector v,
int off,
int len)
Get copy of part of given length of given vector starting from given offset.
|
static Vector |
elementWiseMinus(Vector vec1,
Vector vec2)
Performs in-place vector subtraction.
|
static Vector |
elementWiseTimes(Vector vec1,
Vector vec2)
Performs in-place vector multiplication.
|
static Vector |
num2Vec(int num,
int vecSize)
Turn number into a local Vector of given size with one-hot encoding.
|
static Vector |
num2Vec(int num,
int vecSize,
boolean isDistributed)
Turn number into Vector of given size with one-hot encoding.
|
static Vector |
of(double... values)
Creates dense local on heap vector based on array of doubles.
|
static Vector |
of(Double[] values)
Creates vector based on array of Doubles.
|
static double |
vec2Num(Vector vec)
Turn Vector into number by looking at index of maximal element in vector.
|
static DenseVector |
zeroes(int n)
Create new
|
static Vector |
zeroesLike(Vector v)
Create new vector like given vector initialized by zeroes.
|
static Vector |
zipWith(Vector v1,
Vector v2,
IgniteBiFunction<Double,Double,Double> f)
Zip two vectors with given binary function
(i.e. apply binary function to both vector elementwise and construct vector from results).
|
public static Vector zeroesLike(Vector v)
public static DenseVector zeroes(int n)
public static Vector num2Vec(int num, int vecSize)
num
- Number to turn into vector.vecSize
- Vector size of output vector.public static Vector num2Vec(int num, int vecSize, boolean isDistributed)
num
- Number to turn into vector.vecSize
- Vector size of output vector.isDistributed
- Flag indicating if distributed vector should be created.public static double vec2Num(Vector vec)
vec
- Vector to be turned into number.public static Vector elementWiseTimes(Vector vec1, Vector vec2)
vec1
- Operand to be changed and first multiplication operand.vec2
- Second multiplication operand.public static Vector elementWiseMinus(Vector vec1, Vector vec2)
vec1
- Operand to be changed and subtracted from.vec2
- Operand to subtract.public static Vector zipWith(Vector v1, Vector v2, IgniteBiFunction<Double,Double,Double> f)
v1
- First vector.v2
- Second vector.f
- Function to zip with.public static Vector copyPart(Vector v, int off, int len)
v
- Vector to copy part from.off
- Offset.len
- Length.public static Vector of(double... values)
values
- Values.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019