Package it.unimi.dsi.stat
Class SummaryStats
- java.lang.Object
-
- it.unimi.dsi.stat.SummaryStats
-
- All Implemented Interfaces:
Size64
public class SummaryStats extends Object implements Size64
A simple class digesting a stream of numbers and providing basic statistics about the stream. You just have to create an instance, calladd(double)oraddAll(DoubleList)to add elements.This class is thread-safe. All methods can be invoked concurrently.
- Author:
- Sebastiano Vigna
-
-
Constructor Summary
Constructors Constructor Description SummaryStats()
-
Method Summary
Modifier and Type Method Description voidadd(double x)Adds a value to the stream.voidaddAll(double[] a)Adds values to the stream.voidaddAll(DoubleList l)Adds values to the stream.doublemax()Returns the maximum of the values added so far.doublemean()Returns the mean of the values added so far.doublemin()Returns the minimum of the values added so far.doublerelativeStandardDeviation()Returns the relative standard deviation of the values added so far.doublesampleRelativeStandardDeviation()Returns the sample relative standard deviation of the values added so far.doublesampleStandardDeviation()Returns the sample standard deviation of the values added so far.doublesampleVariance()Returns the sample variance of the values added so far.intsize()Deprecated.longsize64()Returns the number of values added so far.doublestandardDeviation()Returns the standard deviation of the values added so far.doublesum()Returns the sum of the values added so far.StringtoString()doublevariance()Returns the variance of the values added so far.
-
-
-
Method Detail
-
add
public void add(double x)
Adds a value to the stream.- Parameters:
x- the new value.
-
addAll
public void addAll(double[] a)
Adds values to the stream.- Parameters:
a- an array of new values.
-
addAll
public void addAll(DoubleList l)
Adds values to the stream.- Parameters:
l- a list of new values.
-
mean
public double mean()
Returns the mean of the values added so far.- Returns:
- the mean of the values added so far.
-
sum
public double sum()
Returns the sum of the values added so far.- Returns:
- the sum of the values added so far.
-
sampleVariance
public double sampleVariance()
Returns the sample variance of the values added so far.- Returns:
- the sample variance of the values added so far.
- See Also:
variance()
-
variance
public double variance()
Returns the variance of the values added so far.- Returns:
- the variance of the values added so far.
- See Also:
sampleVariance()
-
sampleStandardDeviation
public double sampleStandardDeviation()
Returns the sample standard deviation of the values added so far.- Returns:
- the sample standard deviation of the values added so far.
- See Also:
standardDeviation()
-
standardDeviation
public double standardDeviation()
Returns the standard deviation of the values added so far.- Returns:
- the standard deviation of the values added so far.
- See Also:
sampleStandardDeviation()
-
sampleRelativeStandardDeviation
public double sampleRelativeStandardDeviation()
Returns the sample relative standard deviation of the values added so far.- Returns:
- the sample relative standard deviation of the values added so far.
- See Also:
relativeStandardDeviation()
-
relativeStandardDeviation
public double relativeStandardDeviation()
Returns the relative standard deviation of the values added so far.- Returns:
- the relative standard deviation of the values added so far.
- See Also:
sampleRelativeStandardDeviation()
-
min
public double min()
Returns the minimum of the values added so far.- Returns:
- the minimum of the values added so far.
-
max
public double max()
Returns the maximum of the values added so far.- Returns:
- the maximum of the values added so far.
-
size64
public long size64()
Returns the number of values added so far.
-
size
@Deprecated public int size()
Deprecated.
-
-