Public Types | Public Member Functions | Protected Attributes

mln::accu::stat::variance< T, S, R > Struct Template Reference
[On values]

Variance accumulator class. More...

#include <variance.hh>

Inheritance diagram for mln::accu::stat::variance< T, S, R >:
Inheritance graph

List of all members.

Public Types

typedef T argument
typedef Accumulator< void > category
typedef variance< T, S, R > exact_t
typedef R q_result
typedef R result

Public Member Functions

bool is_valid () const
 Check whether this accu is able to return a result.
mean () const
 Get the mean value.
unsigned n_items () const
 Get the number of items.
standard_deviation () const
 Get the standard deviation value.
subj_ ()
sum () const
 Get the sum value.
void take_as_init (const T &t)
 Take as initialization the value t.
void take_as_init_ (const T &t)
 Default implementation of "take as initialization".
void take_n_times (unsigned n, const T &t)
 Take n times the value t.
void take_n_times_ (unsigned n, const T &t)
 Default implementation of "take n times".
to_result () const
 Get the accumulator result (the variance value).
var () const
 Get the variance value.
 variance ()

void init ()
 Manipulators.
void take_as_init (const argument &t)
void take (const argument &t)
void take (const variance< T, S, R > &other)
void take (unsigned n_times, const argument &t)

Protected Attributes

unsigned n_
sum2_
sum_

Detailed Description

template<typename T, typename S = typename mln::value::props< T >::sum, typename R = S>
struct mln::accu::stat::variance< T, S, R >

Variance accumulator class.

Parameter T is the type of values that we sum. Parameter S is the type to store the value sum and the sum of value * value; the default type of S is the summation type (property) of T. Parameter R is the type of the mean and variance values; the default type of R is S.

Definition at line 61 of file variance.hh.


Member Typedef Documentation

template<typename T, typename S = typename mln::value::props< T >::sum, typename R = S>
typedef T mln::accu::stat::variance< T, S, R >::argument

Definition at line 63 of file variance.hh.

typedef Accumulator<void> mln::Accumulator< variance< T, S, R > >::category [inherited]

Reimplemented from mln::Proxy< variance< T, S, R > >.

Definition at line 80 of file accumulator.hh.

typedef variance< T, S, R > mln::Object< variance< T, S, R > >::exact_t [inherited]

Definition at line 173 of file object.hh.

typedef R mln::accu::internal::base< R, variance< T, S, R > >::q_result [inherited]

Definition at line 58 of file base.hh.

template<typename T, typename S = typename mln::value::props< T >::sum, typename R = S>
typedef R mln::accu::stat::variance< T, S, R >::result

Reimplemented from mln::accu::internal::base< R, variance< T, S, R > >.

Definition at line 64 of file variance.hh.


Constructor & Destructor Documentation

template<typename T , typename S , typename R >
mln::accu::stat::variance< T, S, R >::variance (  )  [inline]

Definition at line 117 of file variance.hh.

References mln::accu::stat::variance< T, S, R >::init().


Member Function Documentation

template<typename T , typename S , typename R >
void mln::accu::stat::variance< T, S, R >::init (  )  [inline]
template<typename T , typename S , typename R >
bool mln::accu::stat::variance< T, S, R >::is_valid (  )  const [inline]

Check whether this accu is able to return a result.

Always true here.

Definition at line 229 of file variance.hh.

References mln::accu::stat::variance< T, S, R >::n_.

template<typename T , typename S , typename R >
R mln::accu::stat::variance< T, S, R >::mean (  )  const [inline]
template<typename T , typename S , typename R >
unsigned mln::accu::stat::variance< T, S, R >::n_items (  )  const [inline]

Get the number of items.

Definition at line 205 of file variance.hh.

References mln::accu::stat::variance< T, S, R >::n_.

template<typename T , typename S , typename R >
R mln::accu::stat::variance< T, S, R >::standard_deviation (  )  const [inline]

Get the standard deviation value.

Definition at line 221 of file variance.hh.

References mln::accu::stat::variance< T, S, R >::to_result().

R mln::accu::internal::base< R, variance< T, S, R > >::subj_ (  )  [inherited]
template<typename T , typename S , typename R >
S mln::accu::stat::variance< T, S, R >::sum (  )  const [inline]

Get the sum value.

Definition at line 197 of file variance.hh.

References mln::accu::stat::variance< T, S, R >::sum_.

template<typename T , typename S , typename R >
void mln::accu::stat::variance< T, S, R >::take ( const variance< T, S, R > &  other  )  [inline]
template<typename T , typename S , typename R >
void mln::accu::stat::variance< T, S, R >::take ( unsigned  n_times,
const argument t 
) [inline]
template<typename T , typename S , typename R >
void mln::accu::stat::variance< T, S, R >::take ( const argument t  )  [inline]
template<typename T , typename S , typename R >
void mln::accu::stat::variance< T, S, R >::take_as_init ( const argument t  )  [inline]
void mln::Accumulator< variance< T, S, R > >::take_as_init ( const T &  t  )  [inherited]

Take as initialization the value t.

Dev note: this is a final method; override if needed by take_as_init_ (ending with '_').

void mln::Accumulator< variance< T, S, R > >::take_as_init_ ( const T &  t  )  [inherited]

Default implementation of "take as initialization".

void mln::Accumulator< variance< T, S, R > >::take_n_times ( unsigned  n,
const T &  t 
) [inherited]

Take n times the value t.

Dev note: this is a final method; override if needed by take_as_init_ (ending with '_').

void mln::Accumulator< variance< T, S, R > >::take_n_times_ ( unsigned  n,
const T &  t 
) [inherited]

Default implementation of "take n times".

template<typename T , typename S , typename R >
R mln::accu::stat::variance< T, S, R >::to_result (  )  const [inline]
template<typename T , typename S , typename R >
R mln::accu::stat::variance< T, S, R >::var (  )  const [inline]

Get the variance value.

Definition at line 213 of file variance.hh.

References mln::accu::stat::variance< T, S, R >::to_result().


Member Data Documentation

template<typename T, typename S = typename mln::value::props< T >::sum, typename R = S>
unsigned mln::accu::stat::variance< T, S, R >::n_ [protected]
template<typename T, typename S = typename mln::value::props< T >::sum, typename R = S>
S mln::accu::stat::variance< T, S, R >::sum2_ [protected]
template<typename T, typename S = typename mln::value::props< T >::sum, typename R = S>
S mln::accu::stat::variance< T, S, R >::sum_ [protected]