public class Accumulator
extends java.lang.Object
Accumulates the following quantities.
Returns these values as well as the variance and standard deviation.
Modifier and Type | Field and Description |
---|---|
protected long |
count
Count of elements.
|
protected double |
maximum
Maximum of elements.
|
protected double |
mean
Mean of elements.
|
protected double |
minimum
Minimum of elements.
|
protected double |
sumOfSquares
Sum of squares of elements.
|
Constructor and Description |
---|
Accumulator()
Create an empty accumulator.
|
Modifier and Type | Method and Description |
---|---|
void |
addValue(double value)
Add a value to the accumulation.
|
void |
addValues(java.util.Collection<java.lang.Double> values)
Add collection of values to the accumulation.
|
void |
addValues(double[] values)
Add array of values to the accumulation.
|
long |
getCount()
Return count.
|
double |
getMaximum()
Return maximum.
|
double |
getMean()
Return mean.
|
double |
getMinimum()
Return minimum.
|
double |
getStandardDeviation()
Return standard deviation.
|
double |
getSumOfSquares()
Return sum of squares.
|
double |
getVariance()
Return variance.
|
protected long count
protected double mean
protected double sumOfSquares
protected double minimum
protected double maximum
public void addValue(double value)
value
- The value to add.public void addValues(java.util.Collection<java.lang.Double> values)
values
- The collection of values to add.public void addValues(double[] values)
values
- The collection of values to add.public long getCount()
public double getMaximum()
public double getMinimum()
public double getMean()
public double getVariance()
The variance is the sum of squares divided by the number of values.
public double getStandardDeviation()
The standard deviation is the square root of the variance.
public double getSumOfSquares()