org.apache.commons.math.stat.univariate.moment
Class GeometricMean

java.lang.Object
  extended byorg.apache.commons.math.stat.univariate.AbstractUnivariateStatistic
      extended byorg.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatistic
          extended byorg.apache.commons.math.stat.univariate.summary.SumOfLogs
              extended byorg.apache.commons.math.stat.univariate.moment.GeometricMean
All Implemented Interfaces:
Serializable, StorelessUnivariateStatistic, UnivariateStatistic

public class GeometricMean
extends SumOfLogs
implements Serializable

Returns the geometric mean of the available values

Version:
$Revision: 1.14 $ $Date: 2003/11/19 03:28:24 $
See Also:
Serialized Form

Field Summary
protected  int n
           
 
Constructor Summary
GeometricMean()
           
 
Method Summary
 void clear()
          Clears all the internal state of the Statistic
 double evaluate(double[] values, int begin, int length)
          Returns the geometric mean for this collection of values
 double getResult()
          Returns the current state of the statistic after the last increment.
 void increment(double d)
          Increments the internal state of the Storagless Implementation.
 
Methods inherited from class org.apache.commons.math.stat.univariate.summary.SumOfLogs
getN
 
Methods inherited from class org.apache.commons.math.stat.univariate.AbstractUnivariateStatistic
evaluate, test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.math.stat.univariate.UnivariateStatistic
evaluate
 

Field Detail

n

protected int n
Constructor Detail

GeometricMean

public GeometricMean()
Method Detail

increment

public void increment(double d)
Description copied from interface: StorelessUnivariateStatistic
Increments the internal state of the Storagless Implementation.

Specified by:
increment in interface StorelessUnivariateStatistic
Overrides:
increment in class SumOfLogs
See Also:
StorelessUnivariateStatistic.increment(double)

getResult

public double getResult()
Description copied from interface: StorelessUnivariateStatistic
Returns the current state of the statistic after the last increment.

Specified by:
getResult in interface StorelessUnivariateStatistic
Overrides:
getResult in class SumOfLogs
See Also:
StorelessUnivariateStatistic.getResult()

clear

public void clear()
Description copied from interface: StorelessUnivariateStatistic
Clears all the internal state of the Statistic

Specified by:
clear in interface StorelessUnivariateStatistic
Overrides:
clear in class SumOfLogs
See Also:
StorelessUnivariateStatistic.clear()

evaluate

public double evaluate(double[] values,
                       int begin,
                       int length)
Returns the geometric mean for this collection of values

Specified by:
evaluate in interface UnivariateStatistic
Overrides:
evaluate in class SumOfLogs
Parameters:
values - Is a double[] containing the values
begin - processing at this point in the array
length - processing at this point in the array
Returns:
the geometric mean or Double.NaN if the array is empty or any of the values are <= 0.
See Also:
UnivariateStatistic.evaluate(double[], int, int)


Copyright © 2003-2004 Apache Software Foundation. All Rights Reserved.