JUCE

- Main Page
- Related Pages
- Topics
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Loading...
Searching...
No Matches
Public Member Functions | List of all members
StatisticsAccumulator< FloatType > Class Template Reference
juce_core » maths

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

`#include <juce_StatisticsAccumulator.h>`

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

## Detailed Description

template<typename FloatType>
class StatisticsAccumulator< FloatType >

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

## Constructor & Destructor Documentation

## ◆ StatisticsAccumulator()

template<typename FloatType >

StatisticsAccumulator< FloatType >::StatisticsAccumulator | ( |  | ) |
| default

Constructs a new StatisticsAccumulator.

## Member Function Documentation

## ◆ addValue()

template<typename FloatType >

void StatisticsAccumulator< FloatType >::addValue | ( | FloatType | v | ) |
| noexcept

Add a new value to the accumulator.

This will update all running statistics accordingly.

References jassert, and juce_isfinite().

## ◆ reset()

template<typename FloatType >

void StatisticsAccumulator< FloatType >::reset | ( |  | ) |
| noexcept

Reset the accumulator.

This will reset all currently saved statistcs.

## ◆ getAverage()

template<typename FloatType >

FloatType StatisticsAccumulator< FloatType >::getAverage | ( |  | ) | const
| noexcept

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

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

## ◆ getVariance()

template<typename FloatType >

FloatType StatisticsAccumulator< FloatType >::getVariance | ( |  | ) | const
| noexcept

Returns the variance of all previously added values.

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

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

## ◆ getStandardDeviation()

template<typename FloatType >

FloatType StatisticsAccumulator< FloatType >::getStandardDeviation | ( |  | ) | const
| noexcept

Returns the standard deviation of all previously added values.

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

References StatisticsAccumulator< FloatType >::getVariance().

## ◆ getMinValue()

template<typename FloatType >

FloatType StatisticsAccumulator< FloatType >::getMinValue | ( |  | ) | const
| noexcept

Returns the smallest of all previously added values.

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

## ◆ getMaxValue()

template<typename FloatType >

FloatType StatisticsAccumulator< FloatType >::getMaxValue | ( |  | ) | const
| noexcept

Returns the largest of all previously added values.

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

## ◆ getCount()

template<typename FloatType >

size_t StatisticsAccumulator< FloatType >::getCount | ( |  | ) | const
| noexcept

Returns how many values have been added to this accumulator.

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

- juce_StatisticsAccumulator.h