org.apache.commons.math.stat.univariate.moment
Class GeometricMean
java.lang.Object
org.apache.commons.math.stat.univariate.AbstractUnivariateStatistic
org.apache.commons.math.stat.univariate.AbstractStorelessUnivariateStatistic
org.apache.commons.math.stat.univariate.summary.SumOfLogs
org.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
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
n
protected int n
GeometricMean
public GeometricMean()
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 valuesbegin
- processing at this point in the arraylength
- 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.