IT++ Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mog_diag.h
Go to the documentation of this file.
1 
29 #ifndef MOG_DIAG_H
30 #define MOG_DIAG_H
31 
32 #include <itpp/stat/mog_generic.h>
33 
34 
35 namespace itpp
36 {
37 
54 class MOG_diag : public MOG_generic
55 {
56 
57 public:
58 
65 
69  MOG_diag(const std::string &name) { zero_all_ptrs(); load(name); }
70 
76  MOG_diag(const int &K_in, const int &D_in, bool full_in = false) { zero_all_ptrs(); init(K_in, D_in, full_in); }
77 
84  MOG_diag(Array<vec> &means_in, bool) { zero_all_ptrs(); init(means_in, false); }
85 
92  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); }
93 
101  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(); }
102 
105 
111 
117  void load(const std::string &name_in);
118 
120  void convert_to_full() {};
121 
123  double log_lhood_single_gaus(const double * c_x_in, const int k) const;
124 
126  double log_lhood_single_gaus(const vec &x_in, const int k) const;
127 
129  double log_lhood(const double * c_x_in);
130 
132  double log_lhood(const vec &x_in);
133 
135  double lhood(const double * c_x_in);
136 
138  double lhood(const vec &x_in);
139 
141  double avg_log_lhood(const double ** c_x_in, int N);
142 
144  double avg_log_lhood(const Array<vec> & X_in);
145 
146 protected:
147 
148  void setup_means();
149  void setup_covs();
150  void setup_weights();
151  void setup_misc();
152 
154  double log_lhood_single_gaus_internal(const double * c_x_in, const int k) const;
156  double log_lhood_single_gaus_internal(const vec &x_in, const int k) const;
158  double log_lhood_internal(const double * c_x_in);
160  double log_lhood_internal(const vec &x_in);
162  double lhood_internal(const double * c_x_in);
164  double lhood_internal(const vec &x_in);
165 
167  double ** enable_c_access(Array<vec> & A_in);
168 
170  int ** enable_c_access(Array<ivec> & A_in);
171 
173  double * enable_c_access(vec & v_in);
174 
176  int * enable_c_access(ivec & v_in);
177 
179  double ** disable_c_access(double ** A_in);
180 
182  int ** disable_c_access(int ** A_in);
183 
185  double * disable_c_access(double * v_in);
186 
188  int * disable_c_access(int * v_in);
189 
191  void zero_all_ptrs();
193  void free_all_ptrs();
194 
196  double ** c_means;
197 
199  double ** c_diag_covs;
200 
203 
205  double * c_weights;
206 
208  double * c_log_weights;
209 
211  double * c_log_det_etc;
212 
213 private:
214 
215  vec tmpvecK;
216  double * c_tmpvecK;
217 
218 };
219 
220 }
221 
222 #endif // #ifndef MOG_DIAG_H
223 
SourceForge Logo

Generated on Fri Mar 21 2014 17:14:14 for IT++ by Doxygen 1.8.1.2