Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
gnsstk::PowerSum Class Reference

Detailed Description

This class computes the power sums of a list of numbers and computes various statistical values based upon these sums. This is a generalization of the Stats class that supports the higher-order moments. See http://mathworld.wolfram.com/PowerSum.html for a discussion of this approach.

Definition at line 57 of file PowerSum.hpp.

#include <PowerSum.hpp>

Public Types

typedef std::list< double >::const_iterator dlc_iterator
 

Public Member Functions

void add (dlc_iterator b, dlc_iterator e) noexcept
 Adds all value in the list to the sums. More...
 
void add (double x) noexcept
 Add a single value to the sums. More...
 
double average () const noexcept
 Computes the indicated value. More...
 
void clear () noexcept
 Reset all sums. More...
 
void dump (std::ostream &str) const noexcept
 
double kurtosis () const noexcept
 
double moment (int i) const noexcept
 Computes the ith order central moment. More...
 
 PowerSum ()
 
long size () const noexcept
 Reuturn the number of points in the current sum. More...
 
double skew () const noexcept
 
void subtract (dlc_iterator b, dlc_iterator e) noexcept
 
void subtract (double x) noexcept
 
double variance () const noexcept
 

Static Public Attributes

const static int order = 5
 

Private Attributes

long n
 
double s [order+1]
 

Member Typedef Documentation

◆ dlc_iterator

typedef std::list<double>::const_iterator gnsstk::PowerSum::dlc_iterator

Definition at line 77 of file PowerSum.hpp.

Constructor & Destructor Documentation

◆ PowerSum()

gnsstk::PowerSum::PowerSum ( )
inline

Definition at line 60 of file PowerSum.hpp.

Member Function Documentation

◆ add() [1/2]

void gnsstk::PowerSum::add ( dlc_iterator  b,
dlc_iterator  e 
)
noexcept

Adds all value in the list to the sums.

Definition at line 67 of file PowerSum.cpp.

◆ add() [2/2]

void gnsstk::PowerSum::add ( double  x)
noexcept

Add a single value to the sums.

Definition at line 51 of file PowerSum.cpp.

◆ average()

double gnsstk::PowerSum::average ( ) const
noexcept

Computes the indicated value.

Definition at line 107 of file PowerSum.cpp.

◆ clear()

void gnsstk::PowerSum::clear ( )
noexcept

Reset all sums.

Definition at line 44 of file PowerSum.cpp.

◆ dump()

void gnsstk::PowerSum::dump ( std::ostream &  str) const
noexcept

Definition at line 137 of file PowerSum.cpp.

◆ kurtosis()

double gnsstk::PowerSum::kurtosis ( ) const
noexcept

Definition at line 129 of file PowerSum.cpp.

◆ moment()

double gnsstk::PowerSum::moment ( int  i) const
noexcept

Computes the ith order central moment.

See http://mathworld.wolfram.com/SampleCentralMoment.html for computing the central moments from the power sums.

Definition at line 83 of file PowerSum.cpp.

◆ size()

long gnsstk::PowerSum::size ( ) const
inlinenoexcept

Reuturn the number of points in the current sum.

Definition at line 90 of file PowerSum.hpp.

◆ skew()

double gnsstk::PowerSum::skew ( ) const
noexcept

Definition at line 122 of file PowerSum.cpp.

◆ subtract() [1/2]

void gnsstk::PowerSum::subtract ( dlc_iterator  b,
dlc_iterator  e 
)
noexcept

Removes all values in the list from the sums. See the warning with the subtract(double) method.

Definition at line 74 of file PowerSum.cpp.

◆ subtract() [2/2]

void gnsstk::PowerSum::subtract ( double  x)
noexcept

Remove a single value from the sums. Note that the higher order sums can get quite large in magnitude. When removing a value that is far from the average, it is possible for numerical error to creep into the sums. One way around this is to simply recompute the sums from scratch when this happens.

Definition at line 59 of file PowerSum.cpp.

◆ variance()

double gnsstk::PowerSum::variance ( ) const
noexcept

Definition at line 115 of file PowerSum.cpp.

Member Data Documentation

◆ n

long gnsstk::PowerSum::n
private

Definition at line 102 of file PowerSum.hpp.

◆ order

const static int gnsstk::PowerSum::order = 5
static

Definition at line 62 of file PowerSum.hpp.

◆ s

double gnsstk::PowerSum::s[order+1]
private

Definition at line 101 of file PowerSum.hpp.


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


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:45