Package it.unimi.dsi.stat
Class SummaryStats
java.lang.Object
it.unimi.dsi.stat.SummaryStats
- All Implemented Interfaces:
Size64
A simple class digesting a stream of numbers and providing basic statistics about the stream.
You just have to create an instance, call
add(double)
or addAll(DoubleList)
to
add elements.
This class is thread-safe. All methods can be invoked concurrently.
- Author:
- Sebastiano Vigna
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double x) Adds a value to the stream.void
addAll
(double[] a) Adds values to the stream.void
addAll
(DoubleList l) Adds values to the stream.double
max()
Returns the maximum of the values added so far.double
mean()
Returns the mean of the values added so far.double
min()
Returns the minimum of the values added so far.double
Returns the relative standard deviation of the values added so far.double
Returns the sample relative standard deviation of the values added so far.double
Returns the sample standard deviation of the values added so far.double
Returns the sample variance of the values added so far.int
size()
Deprecated.long
size64()
Returns the number of values added so far.double
Returns the standard deviation of the values added so far.double
sum()
Returns the sum of the values added so far.toString()
double
variance()
Returns the variance of the values added so far.
-
Constructor Details
-
SummaryStats
public SummaryStats()
-
-
Method Details
-
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
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
public double variance()Returns the variance of the values added so far.- Returns:
- the variance of the values added so far.
- See Also:
-
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
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:
-
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
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:
-
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. -
toString
-