Package org.openjdk.jmc.common.item
Class Aggregators.VarianceConsumer
- java.lang.Object
-
- org.openjdk.jmc.common.item.Aggregators.VarianceConsumer
-
- All Implemented Interfaces:
IItemConsumer<Aggregators.VarianceConsumer>
- Enclosing class:
- Aggregators
public static class Aggregators.VarianceConsumer extends Object
Consumer for calculating stddev and variance in a one pass, numerically stable way.
-
-
Constructor Summary
Constructors Constructor Description VarianceConsumer(IMemberAccessor<? extends IQuantity,IItem> accessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
consume(IItem item)
Consumes another item.Number
getStddev(boolean besselCorrection)
Number
getVariance(boolean besselCorrection)
Aggregators.VarianceConsumer
merge(Aggregators.VarianceConsumer other)
Merges this object with the supplied object.
-
-
-
Field Detail
-
n
public long n
-
mean
public double mean
-
M2
public double M2
-
unit
public IUnit unit
-
-
Constructor Detail
-
VarianceConsumer
public VarianceConsumer(IMemberAccessor<? extends IQuantity,IItem> accessor)
-
-
Method Detail
-
getVariance
public Number getVariance(boolean besselCorrection)
-
getStddev
public Number getStddev(boolean besselCorrection)
-
consume
public void consume(IItem item)
Description copied from interface:IItemConsumer
Consumes another item.
-
merge
public Aggregators.VarianceConsumer merge(Aggregators.VarianceConsumer other)
Description copied from interface:IItemConsumer
Merges this object with the supplied object. Normally this is another item consumer of the same type and the output result is a consumer with an internal state that reflects the state of both the current consumer and the input value.- Parameters:
other
- another instance to merge with- Returns:
- the merged instance
-
-