JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::StatisticsAccumulator< FloatType > Class Template Reference

A class that measures various statistics about a series of floating point values that it is given. More...

#include <juce_StatisticsAccumulator.h>

Collaboration diagram for juce::StatisticsAccumulator< FloatType >:

Classes

struct  KahanSum
 

Public Member Functions

 StatisticsAccumulator ()=default
 Constructs a new StatisticsAccumulator. More...
 
void addValue (FloatType v) noexcept
 Add a new value to the accumulator. More...
 
FloatType getAverage () const noexcept
 Returns the average (arithmetic mean) of all previously added values. More...
 
size_t getCount () const noexcept
 Returns how many values have been added to this accumulator. More...
 
FloatType getMaxValue () const noexcept
 Returns the largest of all previously added values. More...
 
FloatType getMinValue () const noexcept
 Returns the smallest of all previously added values. More...
 
FloatType getStandardDeviation () const noexcept
 Returns the standard deviation of all previously added values. More...
 
FloatType getVariance () const noexcept
 Returns the variance of all previously added values. More...
 
void reset () noexcept
 Reset the accumulator. More...
 

Private Attributes

size_t count { 0 }
 
FloatType maximum { -std::numeric_limits<FloatType>::infinity() }
 
FloatType minimum { std::numeric_limits<FloatType>::infinity() }
 
KahanSum sum
 
KahanSum sumSquares
 

Detailed Description

template<typename FloatType>
class juce::StatisticsAccumulator< FloatType >

A class that measures various statistics about a series of floating point values that it is given.

{Core}

Constructor & Destructor Documentation

◆ StatisticsAccumulator()

template<typename FloatType >
juce::StatisticsAccumulator< FloatType >::StatisticsAccumulator ( )
default

Constructs a new StatisticsAccumulator.

Member Function Documentation

◆ addValue()

template<typename FloatType >
void juce::StatisticsAccumulator< FloatType >::addValue ( FloatType  v)
inlinenoexcept

◆ getAverage()

template<typename FloatType >
FloatType juce::StatisticsAccumulator< FloatType >::getAverage ( ) const
inlinenoexcept

Returns the average (arithmetic mean) of all previously added values.

If no values have been added yet, this will return zero.

References juce::StatisticsAccumulator< FloatType >::count, and juce::StatisticsAccumulator< FloatType >::sum.

◆ getCount()

template<typename FloatType >
size_t juce::StatisticsAccumulator< FloatType >::getCount ( ) const
inlinenoexcept

Returns how many values have been added to this accumulator.

References juce::StatisticsAccumulator< FloatType >::count.

◆ getMaxValue()

template<typename FloatType >
FloatType juce::StatisticsAccumulator< FloatType >::getMaxValue ( ) const
inlinenoexcept

Returns the largest of all previously added values.

If no values have been added yet, this will return negative infinity.

References juce::StatisticsAccumulator< FloatType >::maximum.

◆ getMinValue()

template<typename FloatType >
FloatType juce::StatisticsAccumulator< FloatType >::getMinValue ( ) const
inlinenoexcept

Returns the smallest of all previously added values.

If no values have been added yet, this will return positive infinity.

References juce::StatisticsAccumulator< FloatType >::minimum.

◆ getStandardDeviation()

template<typename FloatType >
FloatType juce::StatisticsAccumulator< FloatType >::getStandardDeviation ( ) const
inlinenoexcept

Returns the standard deviation of all previously added values.

If no values have been added yet, this will return zero.

References juce::StatisticsAccumulator< FloatType >::getVariance().

◆ getVariance()

template<typename FloatType >
FloatType juce::StatisticsAccumulator< FloatType >::getVariance ( ) const
inlinenoexcept

Returns the variance of all previously added values.

If no values have been added yet, this will return zero.

References juce::StatisticsAccumulator< FloatType >::count, juce::StatisticsAccumulator< FloatType >::sum, and juce::StatisticsAccumulator< FloatType >::sumSquares.

Referenced by juce::StatisticsAccumulator< FloatType >::getStandardDeviation().

◆ reset()

template<typename FloatType >
void juce::StatisticsAccumulator< FloatType >::reset ( )
inlinenoexcept

Reset the accumulator.

This will reset all currently saved statistcs.

Member Data Documentation

◆ count

◆ maximum

template<typename FloatType >
FloatType juce::StatisticsAccumulator< FloatType >::maximum { -std::numeric_limits<FloatType>::infinity() }
private

◆ minimum

template<typename FloatType >
FloatType juce::StatisticsAccumulator< FloatType >::minimum { std::numeric_limits<FloatType>::infinity() }
private

◆ sum

◆ sumSquares


The documentation for this class was generated from the following file: