Java Utililty Methods Array Sum Square

List of utility methods to do Array Sum Square

Description

The list of methods to do Array Sum Square are organized into topic(s).

Method

doublesumSquaredError(double[] a, double[] b)
Build the sum of the squared difference of all elements with the same index numbers in the arrays.
if (a.length != b.length) {
    throw new IllegalArgumentException("Arrays must be equal length");
double sum = 0;
for (int i = 0; i < a.length; i++) {
    double delta = a[i] - b[i];
    if (!Double.isNaN(delta)) {
        sum += delta * delta;
...
doublesumSquareDev(double[] values, double target)
Computes the sum of squared deviations of from
double sumsq = 0d;
for (int i = 0; i < values.length; i++) {
    final double dev = values[i] - target;
    sumsq += (dev * dev);
return sumsq;
doublesumSquareDoubleArray(double[] v)
sum Square Double Array
double sum = 0;
for (double d : v) {
    sum += d * d;
return sum;
doublesumSquares(double[] aArray)
Computes the sum of the squares all elements in the given array.
double result = 0;
for (final double a : aArray) {
    result += a * a;
return result;
doublesumSquares(double[] data)
Sums the squares of all components; also called the energy of the array.
double ans = 0.0;
for (int k = 0; k < data.length; k++) {
    ans += data[k] * data[k];
return (ans);
floatsumSquares(final float[] a)
sum Squares
return sumSquares(a, 0, a.length);
floatsumSquares(float[] in)
sum Squares
float sum = 0;
for (int i = 0; i < in.length; i++) {
    sum += (in[i] * in[i]);
return sum;
doublesumValuesSquared(double[] vector)
Compute the sum of values squared in an array
double sum = 0;
for (double v : vector)
    sum += v * v;
return sum;