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 
00086   MOG_diag(Array<vec> &means_in, bool) { zero_all_ptrs(); init(means_in, false);  }
00087 
00094   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); }
00095 
00103   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(); }
00104 
00106   ~MOG_diag() { cleanup(); }
00107 
00112   void cleanup() { free_all_ptrs(); MOG_generic::cleanup(); }
00113 
00119   void load(const std::string &name_in);
00120 
00122   void convert_to_full() {};
00123 
00125   double log_lhood_single_gaus(const double * c_x_in, const int k) const;
00126 
00128   double log_lhood_single_gaus(const vec &x_in, const int k) const;
00129 
00131   double log_lhood(const double * c_x_in);
00132 
00134   double log_lhood(const vec &x_in);
00135 
00137   double lhood(const double * c_x_in);
00138 
00140   double lhood(const vec &x_in);
00141 
00143   double avg_log_lhood(const double ** c_x_in, int N);
00144 
00146   double avg_log_lhood(const Array<vec> & X_in);
00147 
00148 protected:
00149 
00150   void setup_means();
00151   void setup_covs();
00152   void setup_weights();
00153   void setup_misc();
00154 
00156   double log_lhood_single_gaus_internal(const double * c_x_in, const int k) const;
00158   double log_lhood_single_gaus_internal(const vec &x_in, const int k) const;
00160   double log_lhood_internal(const double * c_x_in);
00162   double log_lhood_internal(const vec &x_in);
00164   double lhood_internal(const double * c_x_in);
00166   double lhood_internal(const vec &x_in);
00167 
00169   double ** enable_c_access(Array<vec> & A_in);
00170 
00172   int ** enable_c_access(Array<ivec> & A_in);
00173 
00175   double * enable_c_access(vec & v_in);
00176 
00178   int * enable_c_access(ivec & v_in);
00179 
00181   double ** disable_c_access(double ** A_in);
00182 
00184   int ** disable_c_access(int ** A_in);
00185 
00187   double * disable_c_access(double * v_in);
00188 
00190   int * disable_c_access(int * v_in);
00191 
00193   void zero_all_ptrs();
00195   void free_all_ptrs();
00196 
00198   double ** c_means;
00199 
00201   double ** c_diag_covs;
00202 
00204   double ** c_diag_covs_inv_etc;
00205 
00207   double * c_weights;
00208 
00210   double * c_log_weights;
00211 
00213   double * c_log_det_etc;
00214 
00215 private:
00216 
00217   vec tmpvecK;
00218   double * c_tmpvecK;
00219 
00220 };
00221 
00222 }
00223 
00224 #endif // #ifndef MOG_DIAG_H
00225 
SourceForge Logo

Generated on Fri Jul 25 12:43:00 2008 for IT++ by Doxygen 1.5.4