Constructor and Description |
---|
VectorUtils() |
Modifier and Type | Method and Description |
---|---|
static Vector |
concat(Vector... vs)
Concatenates given vectors.
|
static Vector |
concat(Vector v1,
Vector... vs)
Concatenates given vectors.
|
static Vector |
concat(Vector v1,
Vector v2)
Concatenates two given vectors.
|
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 DenseVector |
fill(double val,
int n)
Create new vector of specified size n with specified value.
|
static IgniteFunction<Vector,Vector> |
getProjector(int[] mapping)
Get projector from index mapping.
|
static double[] |
num2Arr(double val)
Turn number to 1-sized array.
|
static Vector |
num2Vec(double val)
Wrap specified value into vector.
|
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 NamedVector |
of(Map<String,Double> values)
Creates named vector based on map of keys and values.
|
static Vector |
oneHot(int num,
int vecSize)
Turn number into a local Vector of given size with one-hot encoding.
|
static Vector |
oneHot(int num,
int vecSize,
boolean isDistributed)
Turn number into Vector of given size with one-hot encoding.
|
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 DenseVector fill(double val, int n)
val
- Value.n
- Size;public static Vector num2Vec(double val)
val
- Value to wrap.public static Vector oneHot(int num, int vecSize)
num
- Number to turn into vector.vecSize
- Vector size of output vector.public static double[] num2Arr(double val)
val
- Value to wrap in array.public static Vector oneHot(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.public static Vector of(Double[] values)
values
- Values.public static NamedVector of(Map<String,Double> values)
values
- Values.public static Vector concat(Vector v1, Vector v2)
v1
- First vector.v2
- Second vector.public static Vector concat(Vector v1, Vector... vs)
v1
- First vector.vs
- Other vectors.public static Vector concat(Vector... vs)
vs
- Other vectors.public static IgniteFunction<Vector,Vector> getProjector(int[] mapping)
mapping
- Index mapping.
GridGain In-Memory Computing Platform : ver. 8.9.14 Release Date : November 5 2024