public class VectorTools
extends java.lang.Object
Constructor and Description |
---|
VectorTools() |
Modifier and Type | Method and Description |
---|---|
static double[] |
element_wise_multiplication(double[] x,
double[] y)
Element-wise multiplication of two vectors.
|
static boolean |
findInVector(int needle,
java.util.Vector<java.lang.Integer> haystack)
Is a given value in a vector?
|
static int[] |
getIndexesOfValuesExceedingThreshold(double[] vals,
double threshold)
/Indexes of the values at or above the threshold
|
static double |
mean(double[] x)
Mean of the values in a vector
|
static double |
scalar_product(double[] x,
double[] y)
Scalar product of two vectors.
|
static java.util.Vector<java.lang.Integer> |
setDiff(java.util.Vector<java.lang.Integer> a,
java.util.Vector<java.lang.Integer> b)
Ensemble difference: Returns all the elements that are in a but could not be found in b
|
static double |
sum(double[] x)
Sum of the values in a vector
|
static int |
sum(int[] x)
Sum of the values in a vector
|
static double |
vector_norm(double[] x)
Pythagorean length of the vector: sqrt(x1^2+x2^2+..)
|
public static double mean(double[] x)
x
- The vector of valuespublic static double vector_norm(double[] x)
x
- The vector of valuespublic static double scalar_product(double[] x, double[] y)
x
- First vector of valuesy
- Second vector of valuespublic static double[] element_wise_multiplication(double[] x, double[] y)
x
- First vector of valuesy
- Second vector of valuespublic static int sum(int[] x)
x
- The vector of valuespublic static double sum(double[] x)
x
- The vector of valuespublic static boolean findInVector(int needle, java.util.Vector<java.lang.Integer> haystack)
needle
- The value to be searchedhaystack
- The vector to be searched throughpublic static java.util.Vector<java.lang.Integer> setDiff(java.util.Vector<java.lang.Integer> a, java.util.Vector<java.lang.Integer> b)
a
- Vector with candidate elements to be testedb
- Vector with disallowed elements that should not be in outputpublic static int[] getIndexesOfValuesExceedingThreshold(double[] vals, double threshold)
vals
- Array of valuesthreshold
- Minimal threshold required for elements to be eligible