Java Utililty Methods Array Sum

List of utility methods to do Array Sum

Description

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

Method

doublesum(double[] array)
sum
double cumulant = 0;
for (int i = 0; i < array.length; i++)
    cumulant += array[i];
return cumulant;
doublesum(double[] array)
Computes the sum of the given array.
if (array == null)
    return Double.NaN;
double re = 0;
for (double i : array)
    re += i;
return re;
doublesum(double[] array)
sum
return sum(array, false);
doublesum(double[] array)
Computes the sum of the values in an array of doubles.
double sum = 0.0;
for (int i = 0; i < array.length; i++) {
    sum += array[i];
return sum;
doublesum(double[] array)
sum
return sum(array, array.length);
doublesum(double[] d)
sum
double ret = 0;
for (int i = 0; i < d.length; i++) {
    ret += d[i];
return ret;
doublesum(double[] data)
Build the sum of all elements in the array, ignoring elements that are NaN.
double sum = 0.0;
for (int i = 0; i < data.length; i++) {
    if (Double.isNaN(data[i]))
        continue;
    sum += data[i];
return sum;
doublesum(double[] data)
Build the sum of all elements in the array, ignoring elements that are NaN.
double sum = 0.0;
for (int i = 0; i < data.length; i++) {
    if (Double.isNaN(data[i]))
        continue;
    sum += data[i];
return sum;
doublesum(double[] data, int i_, int n_)
Calculates sum of n items up to position i in the array
double total = 0;
for (int i = i_, n = 0; n < n_; i = i > 0 ? i - 1 : data.length - 1, n++) {
    total += data[i];
return total;
doublesum(double[] dbs)
sum
double value = 0;
for (double d : dbs) {
    value += d;
return value;