Mercurial > hg > segmenter-vamp-plugin
comparison armadillo-2.4.4/include/armadillo_bits/running_stat_vec_bones.hpp @ 0:8b6102e2a9b0
Armadillo Library
author | maxzanoni76 <max.zanoni@eecs.qmul.ac.uk> |
---|---|
date | Wed, 11 Apr 2012 09:27:06 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8b6102e2a9b0 |
---|---|
1 // Copyright (C) 2009-2011 NICTA (www.nicta.com.au) | |
2 // Copyright (C) 2009-2011 Conrad Sanderson | |
3 // | |
4 // This file is part of the Armadillo C++ library. | |
5 // It is provided without any warranty of fitness | |
6 // for any purpose. You can redistribute this file | |
7 // and/or modify it under the terms of the GNU | |
8 // Lesser General Public License (LGPL) as published | |
9 // by the Free Software Foundation, either version 3 | |
10 // of the License or (at your option) any later version. | |
11 // (see http://www.opensource.org/licenses for more info) | |
12 | |
13 | |
14 //! \addtogroup running_stat_vec | |
15 //! @{ | |
16 | |
17 | |
18 | |
19 //! Class for keeping statistics of a continuously sampled process / signal. | |
20 //! Useful if the storage of individual samples is not necessary or desired. | |
21 //! Also useful if the number of samples is not known beforehand or exceeds | |
22 //! available memory. | |
23 template<typename eT> | |
24 class running_stat_vec | |
25 { | |
26 public: | |
27 | |
28 typedef typename get_pod_type<eT>::result T; | |
29 | |
30 inline ~running_stat_vec(); | |
31 inline running_stat_vec(const bool in_calc_cov = false); | |
32 | |
33 inline running_stat_vec(const running_stat_vec& in_rsv); | |
34 | |
35 inline const running_stat_vec& operator=(const running_stat_vec& in_rsv); | |
36 | |
37 template<typename T1> arma_hot inline void operator() (const Base< T, T1>& X); | |
38 template<typename T1> arma_hot inline void operator() (const Base< std::complex<T>, T1>& X); | |
39 | |
40 inline void reset(); | |
41 | |
42 inline const Mat<eT>& mean() const; | |
43 | |
44 inline const Mat< T>& var (const uword norm_type = 0); | |
45 inline Mat< T> stddev(const uword norm_type = 0) const; | |
46 inline const Mat<eT>& cov (const uword norm_type = 0); | |
47 | |
48 inline const Mat<eT>& min() const; | |
49 inline const Mat<eT>& max() const; | |
50 | |
51 inline T count() const; | |
52 | |
53 // | |
54 // | |
55 | |
56 private: | |
57 | |
58 const bool calc_cov; | |
59 | |
60 arma_aligned arma_counter<T> counter; | |
61 | |
62 arma_aligned Mat<eT> r_mean; | |
63 arma_aligned Mat< T> r_var; | |
64 arma_aligned Mat<eT> r_cov; | |
65 | |
66 arma_aligned Mat<eT> min_val; | |
67 arma_aligned Mat<eT> max_val; | |
68 | |
69 arma_aligned Mat< T> min_val_norm; | |
70 arma_aligned Mat< T> max_val_norm; | |
71 | |
72 arma_aligned Mat< T> r_var_dummy; | |
73 arma_aligned Mat<eT> r_cov_dummy; | |
74 | |
75 arma_aligned Mat<eT> tmp1; | |
76 arma_aligned Mat<eT> tmp2; | |
77 | |
78 friend class running_stat_vec_aux; | |
79 }; | |
80 | |
81 | |
82 | |
83 class running_stat_vec_aux | |
84 { | |
85 public: | |
86 | |
87 template<typename eT> | |
88 inline static void update_stats(running_stat_vec< eT >& x, const Mat<eT>& sample); | |
89 | |
90 template<typename T> | |
91 inline static void update_stats(running_stat_vec< std::complex<T> >& x, const Mat< T>& sample); | |
92 | |
93 template<typename T> | |
94 inline static void update_stats(running_stat_vec< std::complex<T> >& x, const Mat< std::complex<T> >& sample); | |
95 | |
96 // | |
97 | |
98 template<typename eT> | |
99 inline static Mat<eT> var(const running_stat_vec< eT >& x, const uword norm_type = 0); | |
100 | |
101 template<typename T> | |
102 inline static Mat< T> var(const running_stat_vec< std::complex<T> >& x, const uword norm_type = 0); | |
103 | |
104 // | |
105 | |
106 template<typename eT> | |
107 inline static Mat< eT > cov(const running_stat_vec< eT >& x, const uword norm_type = 0); | |
108 | |
109 template<typename T> | |
110 inline static Mat< std::complex<T> > cov(const running_stat_vec< std::complex<T> >& x, const uword norm_type = 0); | |
111 }; | |
112 | |
113 | |
114 | |
115 //! @} |