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