Class SummaryStats

  • All Implemented Interfaces:
    it.unimi.dsi.fastutil.Size64

    public class SummaryStats
    extends java.lang.Object
    implements it.unimi.dsi.fastutil.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

      Constructors 
      Constructor Description
      SummaryStats()  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void add​(double x)
      Adds a value to the stream.
      void addAll​(double[] a)
      Adds values to the stream.
      void addAll​(it.unimi.dsi.fastutil.doubles.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 relativeStandardDeviation()
      Returns the relative standard deviation of the values added so far.
      double sampleRelativeStandardDeviation()
      Returns the sample relative standard deviation of the values added so far.
      double sampleStandardDeviation()
      Returns the sample standard deviation of the values added so far.
      double sampleVariance()
      Returns the sample variance of the values added so far.
      int size()
      Deprecated.
      long size64()
      Returns the number of values added so far.
      double standardDeviation()
      Returns the standard deviation of the values added so far.
      double sum()
      Returns the sum of the values added so far.
      java.lang.String toString()  
      double variance()
      Returns the variance of the values added so far.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SummaryStats

        public SummaryStats()
    • 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​(it.unimi.dsi.fastutil.doubles.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.
        Specified by:
        size64 in interface it.unimi.dsi.fastutil.Size64
        Returns:
        the number of values added so far.
      • size

        @Deprecated
        public int size()
        Deprecated.
        Specified by:
        size in interface it.unimi.dsi.fastutil.Size64
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object