A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Average< T > Class Template Reference

Simple average, min, max and std. More...

#include "average.h"

Inheritance diagram for ns3::Average< T >:
Collaboration diagram for ns3::Average< T >:

Public Member Functions

 Average ()
double Avg () const
 Sample average.
uint32_t Count () const
 Sample size.
T Max () const
 Sample maximum.
double Mean () const
 Sample estimate of mean, alias to Avg.
T Min () const
 Sample minimum.
void Reset ()
 Reset statistics.
double Stddev () const
 Sample standard deviation.
void Update (const T &x)
 Add new sample.
double Var () const
 Sample unbiased nbiased estimate of variance.
Error of the mean estimates
double Error90 () const
 Margin of error of the mean for 90% confidence level.
double Error95 () const
 Margin of error of the mean for 95% confidence level.
double Error99 () const
 Margin of error of the mean for 99% confidence level.

Private Attributes

T m_max
 Maximum value observed.
T m_min
 Minimum value observed.
uint32_t m_size
 Number of sampled data.
MinMaxAvgTotalCalculator< double > m_varianceCalculator
 Variance calculator.

Detailed Description

template<typename T = double>
class ns3::Average< T >

Simple average, min, max and std.

deviation calculator

Definition at line 31 of file average.h.

Constructor & Destructor Documentation

◆ Average()

template<typename T = double>
ns3::Average< T >::Average ( )
inline

Definition at line 34 of file average.h.

References m_max, m_min, and m_size.

Member Function Documentation

◆ Avg()

template<typename T = double>
double ns3::Average< T >::Avg ( ) const
inline

Sample average.

Returns
the average of the sample

Definition at line 97 of file average.h.

References m_varianceCalculator.

Referenced by Mean().

Here is the caller graph for this function:

◆ Count()

template<typename T = double>
uint32_t ns3::Average< T >::Count ( ) const
inline

Sample size.

Returns
the sample size

Definition at line 70 of file average.h.

References m_size.

Referenced by FiveDoublesAverageTestCase::DoRun(), FiveIntegersAverageTestCase::DoRun(), OneIntegerAverageTestCase::DoRun(), Error90(), Error95(), and Error99().

Here is the caller graph for this function:

◆ Error90()

template<typename T = double>
double ns3::Average< T >::Error90 ( ) const
inline

Margin of error of the mean for 90% confidence level.

Note that estimates are valid for

  • uncorrelated measurements,
  • normal distribution and
  • large enough sample size.
Returns
Margin of error of the mean for 90% confidence level

Definition at line 144 of file average.h.

References Count(), and Var().

Here is the call graph for this function:

◆ Error95()

template<typename T = double>
double ns3::Average< T >::Error95 ( ) const
inline

Margin of error of the mean for 95% confidence level.

Note that estimates are valid for

  • uncorrelated measurements,
  • normal distribution and
  • large enough sample size.
Returns
Margin of error of the mean for 95% confidence level

Definition at line 159 of file average.h.

References Count(), and Var().

Here is the call graph for this function:

◆ Error99()

template<typename T = double>
double ns3::Average< T >::Error99 ( ) const
inline

Margin of error of the mean for 99% confidence level.

Note that estimates are valid for

  • uncorrelated measurements,
  • normal distribution and
  • large enough sample size.
Returns
Margin of error of the mean for 99% confidence level

Definition at line 175 of file average.h.

References Count(), and Var().

Here is the call graph for this function:

◆ Max()

template<typename T = double>
T ns3::Average< T >::Max ( ) const
inline

Sample maximum.

Returns
the maximum of the sample

Definition at line 88 of file average.h.

References m_max.

Referenced by FiveDoublesAverageTestCase::DoRun(), FiveIntegersAverageTestCase::DoRun(), and OneIntegerAverageTestCase::DoRun().

Here is the caller graph for this function:

◆ Mean()

template<typename T = double>
double ns3::Average< T >::Mean ( ) const
inline

Sample estimate of mean, alias to Avg.

Returns
the average of the sample

Definition at line 106 of file average.h.

References Avg().

Referenced by FiveDoublesAverageTestCase::DoRun(), FiveIntegersAverageTestCase::DoRun(), and OneIntegerAverageTestCase::DoRun().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Min()

template<typename T = double>
T ns3::Average< T >::Min ( ) const
inline

Sample minimum.

Returns
the minimum of the sample

Definition at line 79 of file average.h.

References m_min.

Referenced by FiveDoublesAverageTestCase::DoRun(), FiveIntegersAverageTestCase::DoRun(), and OneIntegerAverageTestCase::DoRun().

Here is the caller graph for this function:

◆ Reset()

template<typename T = double>
void ns3::Average< T >::Reset ( )
inline

Reset statistics.

Definition at line 56 of file average.h.

References m_max, m_min, m_size, and m_varianceCalculator.

◆ Stddev()

template<typename T = double>
double ns3::Average< T >::Stddev ( ) const
inline

Sample standard deviation.

Returns
the standard deviation

Definition at line 124 of file average.h.

References Var().

Referenced by FiveDoublesAverageTestCase::DoRun(), FiveIntegersAverageTestCase::DoRun(), and OneIntegerAverageTestCase::DoRun().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update()

template<typename T = double>
void ns3::Average< T >::Update ( const T & x)
inline

Add new sample.

Parameters
xThe sample

Definition at line 45 of file average.h.

References m_max, m_min, m_size, m_varianceCalculator, and x.

Referenced by FiveDoublesAverageTestCase::DoRun(), FiveIntegersAverageTestCase::DoRun(), and OneIntegerAverageTestCase::DoRun().

Here is the caller graph for this function:

◆ Var()

template<typename T = double>
double ns3::Average< T >::Var ( ) const
inline

Sample unbiased nbiased estimate of variance.

Returns
the unbiased nbiased estimate of variance

Definition at line 115 of file average.h.

References m_varianceCalculator.

Referenced by FiveDoublesAverageTestCase::DoRun(), FiveIntegersAverageTestCase::DoRun(), OneIntegerAverageTestCase::DoRun(), Error90(), Error95(), Error99(), and Stddev().

Here is the caller graph for this function:

Member Data Documentation

◆ m_max

template<typename T = double>
T ns3::Average< T >::m_max
private

Maximum value observed.

Definition at line 185 of file average.h.

Referenced by Average(), Max(), Reset(), and Update().

◆ m_min

template<typename T = double>
T ns3::Average< T >::m_min
private

Minimum value observed.

Definition at line 184 of file average.h.

Referenced by Average(), Min(), Reset(), and Update().

◆ m_size

template<typename T = double>
uint32_t ns3::Average< T >::m_size
private

Number of sampled data.

Definition at line 183 of file average.h.

Referenced by Average(), Count(), Reset(), and Update().

◆ m_varianceCalculator

template<typename T = double>
MinMaxAvgTotalCalculator<double> ns3::Average< T >::m_varianceCalculator
private

Variance calculator.

Definition at line 186 of file average.h.

Referenced by Avg(), Reset(), Update(), and Var().


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