List of utility methods to do Vector Normalize
double | vectorNorm(double[] v) vector Norm double res = 0.0; for (double elem : v) { res = res + elem * elem; return Math.sqrt(res); |
double | vectorNorm(double[] vector) vector Norm return Math.sqrt(vectorDotProduct(vector, vector));
|
double | vectorNorm(final double[] vector) Returns the norm of a vector. if (vector == null) { throw new NullPointerException("Null vector@vectorNorm!"); double temp = 0; for (int i = 0; i < vector.length; i++) { temp += vector[i] * vector[i]; return Math.sqrt(temp); ... |
float | vectorNorm(float[] v) Calculate the norm of a vector float result = 0; for (float aV : v) { result += aV * aV; result = (float) Math.sqrt(result); return result; |
double[] | vectorNormalize(double[] v) Normalizes the given vector. double[] result = new double[v.length]; double sum = 0; for (double d : v) { sum += d; for (int i = 0; i < v.length; i++) { result[i] = v[i] / sum; return result; |
float[] | vectorNorms(boolean[] in, int veclen) vector Norms float[] out = new float[in.length / veclen]; for (int i = 0, k = 0; i < out.length; i++) { out[i] = 0; for (int j = 0; j < veclen; j++, k++) if (in[k]) out[i] += 1; return out; ... |