//! More...
Classes | |
class | arma_counter< eT > |
class | running_stat< eT > |
Class for keeping statistics of a continuously sampled process / signal. //! Useful if the storage of individual samples is not necessary or desired. //! Also useful if the number of samples is not known beforehand or exceeds //! available memory. More... | |
class | running_stat_aux |
Functions | |
arma_counter::~arma_counter () | |
arma_counter::arma_counter () | |
const arma_counter & | arma_counter::operator++ () |
void | arma_counter::operator++ (int) |
void | arma_counter::reset () |
eT | arma_counter::value () const |
eT | arma_counter::value_plus_1 () const |
eT | arma_counter::value_minus_1 () const |
running_stat::~running_stat () | |
running_stat::running_stat () | |
void | running_stat::reset () |
set all statistics to zero | |
eT | running_stat::mean () const |
mean or average value | |
T | running_stat::var (const u32 norm_type=0) const |
variance | |
T | running_stat::stddev (const u32 norm_type=0) const |
standard deviation | |
eT | running_stat::min () const |
minimum value | |
eT | running_stat::max () const |
maximum value | |
template<typename eT > | |
static void | running_stat_aux::update_stats (running_stat< eT > &x, const eT sample) |
update statistics to reflect new sample | |
template<typename T > | |
static void | running_stat_aux::update_stats (running_stat< std::complex< T > > &x, const T sample) |
update statistics to reflect new sample (version for complex numbers) | |
template<typename T > | |
static void | running_stat_aux::update_stats (running_stat< std::complex< T > > &x, const std::complex< T > &sample) |
alter statistics to reflect new sample (version for complex numbers) |
//!
arma_counter< eT >::~arma_counter | ( | ) | [inline, inherited] |
Definition at line 24 of file running_stat_meat.hpp.
{
arma_extra_debug_sigprint_this(this);
}
arma_counter< eT >::arma_counter | ( | ) | [inline, inherited] |
Definition at line 33 of file running_stat_meat.hpp.
const arma_counter< eT > & arma_counter< eT >::operator++ | ( | ) | [inline, inherited] |
Definition at line 45 of file running_stat_meat.hpp.
References arma_counter< eT >::d_count, and arma_counter< eT >::i_count.
Referenced by arma_counter< eT >::operator++().
void arma_counter< eT >::operator++ | ( | int | ) | [inline, inherited] |
Definition at line 67 of file running_stat_meat.hpp.
References arma_counter< eT >::operator++().
{ operator++(); }
void arma_counter< eT >::reset | ( | ) | [inline, inherited] |
Definition at line 77 of file running_stat_meat.hpp.
References arma_counter< eT >::d_count, and arma_counter< eT >::i_count.
Referenced by running_stat_vec< eT >::reset(), and running_stat< eT >::reset().
eT arma_counter< eT >::value | ( | ) | const [inline, inherited] |
Definition at line 88 of file running_stat_meat.hpp.
References arma_counter< eT >::d_count, and arma_counter< eT >::i_count.
Referenced by running_stat_vec< eT >::cov(), running_stat_vec< eT >::stddev(), running_stat_vec_aux::update_stats(), running_stat_aux::update_stats(), running_stat_vec< eT >::var(), and running_stat< eT >::var().
eT arma_counter< eT >::value_plus_1 | ( | ) | const [inline, inherited] |
Definition at line 99 of file running_stat_meat.hpp.
References arma_counter< eT >::d_count, and arma_counter< eT >::i_count.
Referenced by running_stat_vec_aux::update_stats(), and running_stat_aux::update_stats().
eT arma_counter< eT >::value_minus_1 | ( | ) | const [inline, inherited] |
Definition at line 119 of file running_stat_meat.hpp.
References arma_counter< eT >::d_count, and arma_counter< eT >::i_count.
Referenced by running_stat_vec< eT >::cov(), running_stat_vec< eT >::stddev(), running_stat_vec_aux::update_stats(), running_stat_aux::update_stats(), running_stat_vec< eT >::var(), and running_stat< eT >::var().
running_stat< eT >::~running_stat | ( | ) | [inline, inherited] |
Definition at line 139 of file running_stat_meat.hpp.
{
arma_extra_debug_sigprint_this(this);
}
running_stat< eT >::running_stat | ( | ) | [inline, inherited] |
Definition at line 147 of file running_stat_meat.hpp.
: r_mean ( eT(0)) , r_var (typename running_stat<eT>::T(0)) , min_val ( eT(0)) , max_val ( eT(0)) , min_val_norm(typename running_stat<eT>::T(0)) , max_val_norm(typename running_stat<eT>::T(0)) { arma_extra_debug_sigprint_this(this); }
void running_stat< eT >::reset | ( | ) | [inline, inherited] |
set all statistics to zero
Definition at line 196 of file running_stat_meat.hpp.
References running_stat< eT >::counter, running_stat< eT >::max_val, running_stat< eT >::max_val_norm, running_stat< eT >::min_val, running_stat< eT >::min_val_norm, running_stat< eT >::r_mean, running_stat< eT >::r_var, and arma_counter< eT >::reset().
{ arma_extra_debug_sigprint(); typedef typename running_stat<eT>::T T; counter.reset(); r_mean = eT(0); r_var = T(0); min_val = eT(0); max_val = eT(0); min_val_norm = T(0); max_val_norm = T(0); }
eT running_stat< eT >::mean | ( | ) | const [inline, inherited] |
mean or average value
Definition at line 220 of file running_stat_meat.hpp.
References running_stat< eT >::r_mean.
{ arma_extra_debug_sigprint(); return r_mean; }
running_stat< eT >::T running_stat< eT >::var | ( | const u32 | norm_type = 0 |
) | const [inline, inherited] |
variance
Definition at line 234 of file running_stat_meat.hpp.
References running_stat< eT >::counter, running_stat< eT >::r_var, arma_counter< eT >::value(), and arma_counter< eT >::value_minus_1().
running_stat< eT >::T running_stat< eT >::stddev | ( | const u32 | norm_type = 0 |
) | const [inline, inherited] |
standard deviation
Definition at line 265 of file running_stat_meat.hpp.
References sqrt().
{ arma_extra_debug_sigprint(); return std::sqrt( (*this).var(norm_type) ); }
eT running_stat< eT >::min | ( | ) | const [inline, inherited] |
minimum value
Definition at line 279 of file running_stat_meat.hpp.
References running_stat< eT >::min_val.
{ arma_extra_debug_sigprint(); return min_val; }
eT running_stat< eT >::max | ( | ) | const [inline, inherited] |
maximum value
Definition at line 293 of file running_stat_meat.hpp.
References running_stat< eT >::max_val.
{ arma_extra_debug_sigprint(); return max_val; }
void running_stat_aux::update_stats | ( | running_stat< eT > & | x, | |
const eT | sample | |||
) | [inline, static, inherited] |
update statistics to reflect new sample
Definition at line 307 of file running_stat_meat.hpp.
References running_stat< eT >::counter, running_stat< eT >::max_val, running_stat< eT >::min_val, running_stat< eT >::r_mean, running_stat< eT >::r_var, arma_counter< eT >::value(), arma_counter< eT >::value_minus_1(), and arma_counter< eT >::value_plus_1().
Referenced by running_stat_aux::update_stats().
{ arma_extra_debug_sigprint(); typedef typename running_stat<eT>::T T; const T N = x.counter.value(); if(N > T(0)) { if(sample < x.min_val) { x.min_val = sample; } if(sample > x.max_val) { x.max_val = sample; } const T N_plus_1 = x.counter.value_plus_1(); const T N_minus_1 = x.counter.value_minus_1(); // note: variance has to be updated before the mean const eT tmp = sample - x.r_mean; x.r_var = N_minus_1/N * x.r_var + (tmp*tmp)/N_plus_1; x.r_mean = x.r_mean + (sample - x.r_mean)/N_plus_1; //x.r_mean = (N/N_plus_1)*x.r_mean + sample/N_plus_1; //x.r_mean = (x.r_mean + sample/N) * N/N_plus_1; } else { x.r_mean = sample; x.min_val = sample; x.max_val = sample; // r_var is initialised to zero // in the constructor and reset() } x.counter++; }
void running_stat_aux::update_stats | ( | running_stat< std::complex< T > > & | x, | |
const T | sample | |||
) | [inline, static, inherited] |
update statistics to reflect new sample (version for complex numbers)
Definition at line 359 of file running_stat_meat.hpp.
References running_stat_aux::update_stats().
{ arma_extra_debug_sigprint(); running_stat_aux::update_stats(x, std::complex<T>(sample)); }
void running_stat_aux::update_stats | ( | running_stat< std::complex< T > > & | x, | |
const std::complex< T > & | sample | |||
) | [inline, static, inherited] |
alter statistics to reflect new sample (version for complex numbers)
Definition at line 372 of file running_stat_meat.hpp.
References norm().
{ arma_extra_debug_sigprint(); typedef typename std::complex<T> eT; const T sample_norm = std::norm(sample); const T N = x.counter.value(); if(N > T(0)) { if(sample_norm < x.min_val_norm) { x.min_val_norm = sample_norm; x.min_val = sample; } if(sample_norm > x.max_val_norm) { x.max_val_norm = sample_norm; x.max_val = sample; } const T N_plus_1 = x.counter.value_plus_1(); const T N_minus_1 = x.counter.value_minus_1(); x.r_var = N_minus_1/N * x.r_var + std::norm(sample - x.r_mean)/N_plus_1; x.r_mean = x.r_mean + (sample - x.r_mean)/N_plus_1; //x.r_mean = (N/N_plus_1)*x.r_mean + sample/N_plus_1; //x.r_mean = (x.r_mean + sample/N) * N/N_plus_1; } else { x.r_mean = sample; x.min_val = sample; x.max_val = sample; x.min_val_norm = sample_norm; x.max_val_norm = sample_norm; // r_var is initialised to zero // in the constructor and reset() } x.counter++; }