IT++ Logo

mog_diag.h

Go to the documentation of this file.
00001 
00030 #ifndef MOG_DIAG_H
00031 #define MOG_DIAG_H
00032 
00033 #include <itpp/stat/mog_generic.h>
00034 
00035 
00036 namespace itpp
00037 {
00038 
00055 class MOG_diag : public MOG_generic
00056 {
00057 
00058 public:
00059 
00065   MOG_diag() { zero_all_ptrs(); init(); }
00066 
00070   MOG_diag(const std::string &name) { zero_all_ptrs(); load(name); }
00071 
00077   MOG_diag(const int &K_in, const int &D_in, bool full_in = false) { zero_all_ptrs(); init(K_in, D_in, full_in); }
00078 
00085   MOG_diag(Array<vec> &means_in, bool) { zero_all_ptrs(); init(means_in, false);  }
00086 
00093   MOG_diag(Array<vec> &means_in, Array<vec> &diag_covs_in, vec &weights_in) { zero_all_ptrs(); init(means_in, diag_covs_in, weights_in); }
00094 
00102   MOG_diag(Array<vec> &means_in, Array<mat> &full_covs_in, vec &weights_in) { zero_all_ptrs(); init(means_in, full_covs_in, weights_in); convert_to_diag(); }
00103 
00105   ~MOG_diag() { cleanup(); }
00106 
00111   void cleanup() { free_all_ptrs(); MOG_generic::cleanup(); }
00112 
00118   void load(const std::string &name_in);
00119 
00121   void convert_to_full() {};
00122 
00124   double log_lhood_single_gaus(const double * c_x_in, const int k) const;
00125 
00127   double log_lhood_single_gaus(const vec &x_in, const int k) const;
00128 
00130   double log_lhood(const double * c_x_in);
00131 
00133   double log_lhood(const vec &x_in);
00134 
00136   double lhood(const double * c_x_in);
00137 
00139   double lhood(const vec &x_in);
00140 
00142   double avg_log_lhood(const double ** c_x_in, int N);
00143 
00145   double avg_log_lhood(const Array<vec> & X_in);
00146 
00147 protected:
00148 
00149   void setup_means();
00150   void setup_covs();
00151   void setup_weights();
00152   void setup_misc();
00153 
00155   double log_lhood_single_gaus_internal(const double * c_x_in, const int k) const;
00157   double log_lhood_single_gaus_internal(const vec &x_in, const int k) const;
00159   double log_lhood_internal(const double * c_x_in);
00161   double log_lhood_internal(const vec &x_in);
00163   double lhood_internal(const double * c_x_in);
00165   double lhood_internal(const vec &x_in);
00166 
00168   double ** enable_c_access(Array<vec> & A_in);
00169 
00171   int ** enable_c_access(Array<ivec> & A_in);
00172 
00174   double * enable_c_access(vec & v_in);
00175 
00177   int * enable_c_access(ivec & v_in);
00178 
00180   double ** disable_c_access(double ** A_in);
00181 
00183   int ** disable_c_access(int ** A_in);
00184 
00186   double * disable_c_access(double * v_in);
00187 
00189   int * disable_c_access(int * v_in);
00190 
00192   void zero_all_ptrs();
00194   void free_all_ptrs();
00195 
00197   double ** c_means;
00198 
00200   double ** c_diag_covs;
00201 
00203   double ** c_diag_covs_inv_etc;
00204 
00206   double * c_weights;
00207 
00209   double * c_log_weights;
00210 
00212   double * c_log_det_etc;
00213 
00214 private:
00215 
00216   vec tmpvecK;
00217   double * c_tmpvecK;
00218 
00219 };
00220 
00221 }
00222 
00223 #endif // #ifndef MOG_DIAG_H
00224 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SourceForge Logo

Generated on Wed Jan 20 23:03:06 2010 for IT++ by Doxygen 1.6.2