List of utility methods to do Array Sum Square
double | sumOfSquares(double[] vector) This returns the sum of squares for the given vector. double ret = 0; for (double d : vector) ret += Math.pow(d, 2); return ret; |
double | sumOfSquares(double[] vector) sum Of Squares double sum = 0; for (double d : vector) sum += sq(d); return sum; |
int | sumOfSquares(int numberOfTerms) sum Of Squares return (int) (((double) numberOfTerms / 6) * (numberOfTerms + 1) * (2 * numberOfTerms + 1)); |
double | sumOfSquares(Number[] array) Returns sum of all the squared elements in the array. double result; int i; result = 0.0; for (i = 0; i < array.length; i++) result += array[i].doubleValue() * array[i].doubleValue(); return result; |
double | sumSq(double... values) sum Sq double sum = 0; for (double v : values) { sum += v * v; return sum; |
double | sumSq(double[] a) Returns the sum of squares. return sumSq(a, 0, a.length);
|
int | sumSqual(byte[] b) sum Squal int sum = 0; for (int i = 0; i < b.length; i++) { sum += (int) Math.pow(b[i], 2); return sum; |
double | sumSquared(double[] data) sum Squared return sumSquared(data, 0.0);
|
double | sumSquared(double[] data, double term) sum Squared double sum = 0.0; for (int i = 0; i < data.length; i++) { if (Double.isNaN(data[i])) continue; sum += (data[i] + term) * (data[i] + term); return sum; |
int | SumSquared(Object in) Sum Squared if (in == null) return 0; if (in instanceof int[]) { int[] inn = (int[]) in; int out = 0; for (int i = 0, s = inn.length; i < s; i++) out += inn[i] * inn[i]; return out; ... |