Java mean mean(double[] series)

Here you can find the source of mean(double[] series)

Description

Computes the mean value of timeseries.

License

Open Source License

Parameter

Parameter Description
series The timeseries.

Return

The mean value.

Declaration

public static double mean(double[] series) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from   www  . j a v  a  2s.com
     * Computes the mean value of timeseries.
     *
     * @param series The timeseries.
     * @return The mean value.
     */
    public static double mean(double[] series) {
        double res = 0D;
        int count = 0;
        for (double tp : series) {
            if (Double.isNaN(tp) || Double.isInfinite(tp)) {
            } else {
                res += tp;
                count += 1;
            }
        }
        if (count > 0) {
            return res / ((Integer) count).doubleValue();
        }
        return Double.NaN;
    }
}

Related

  1. mean(double[] data)
  2. mean(double[] doubleArray)
  3. mean(double[] list)
  4. mean(double[] nums)
  5. mean(double[] samples)
  6. mean(double[] v)
  7. mean(double[] values)
  8. mean(double[] vector)
  9. mean(double[] x, boolean[] used)