running_stat_bones.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2009-2011 Conrad Sanderson
00003 // 
00004 // This file is part of the Armadillo C++ library.
00005 // It is provided without any warranty of fitness
00006 // for any purpose. You can redistribute this file
00007 // and/or modify it under the terms of the GNU
00008 // Lesser General Public License (LGPL) as published
00009 // by the Free Software Foundation, either version 3
00010 // of the License or (at your option) any later version.
00011 // (see http://www.opensource.org/licenses for more info)
00012 
00013 
00016 
00017 
00018 
00019 template<typename eT>
00020 class arma_counter
00021   {
00022   public:
00023   
00024   inline ~arma_counter();
00025   inline  arma_counter();
00026   
00027   inline const arma_counter& operator++();
00028   inline void                operator++(int);
00029   
00030   inline void reset();
00031   inline eT   value()         const;
00032   inline eT   value_plus_1()  const;
00033   inline eT   value_minus_1() const;
00034   
00035   
00036   private:
00037   
00038   arma_aligned eT    d_count;
00039   arma_aligned uword i_count;
00040   };
00041 
00042 
00043 
00048 template<typename eT>
00049 class running_stat
00050   {
00051   public:
00052   
00053   typedef typename get_pod_type<eT>::result T;
00054   
00055   
00056   inline ~running_stat();
00057   inline  running_stat();
00058   
00059   inline void operator() (const T sample);
00060   inline void operator() (const std::complex<T>& sample);
00061   
00062   inline void reset();
00063   
00064   inline eT mean() const;
00065   
00066   inline  T var   (const uword norm_type = 0) const;
00067   inline  T stddev(const uword norm_type = 0) const;
00068   
00069   inline eT min()  const;
00070   inline eT max()  const;
00071   
00072   inline T count() const;
00073   
00074   //
00075   //
00076   
00077   private:
00078   
00079   arma_aligned arma_counter<T> counter;
00080   
00081   arma_aligned eT r_mean;
00082   arma_aligned  T r_var;
00083   
00084   arma_aligned eT min_val;
00085   arma_aligned eT max_val;
00086   
00087   arma_aligned  T min_val_norm;
00088   arma_aligned  T max_val_norm;
00089   
00090   
00091   friend class running_stat_aux;
00092   };
00093 
00094 
00095 
00096 class running_stat_aux
00097   {
00098   public:
00099   
00100   template<typename eT>
00101   inline static void update_stats(running_stat<eT>&               x,  const eT               sample);
00102   
00103   template<typename T>
00104   inline static void update_stats(running_stat< std::complex<T> >& x, const T                sample);
00105   
00106   template<typename T>
00107   inline static void update_stats(running_stat< std::complex<T> >& x, const std::complex<T>& sample);
00108   
00109   };
00110 
00111 
00112 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:05