- Main Page
- Related Pages
- Classes
- Files

# work/mixpp/bdm/stat/emix.h

Go to the documentation of this file.

    00001
    00013 #ifndef MX_H
    00014 #define MX_H
    00015
    00016 #include "libBM.h"
    00017 #include "libEF.h"
    00018 //#include <std>
    00019
    00020 using namespace itpp;
    00021
    00032 class emix : public epdf {
    00033 protected:
    00035         vec w;
    00037         Array<epdf*> Coms;
    00038 public:
    00040         emix ( RV &rv ): epdf(rv){};
    00042         void set_parameters ( const vec &w, const Array<epdf*> &Coms );
    00043
    00044         vec sample() const;
    00045         vec mean() const {
    00046                 int i; vec mu=zeros ( rv.count() );
    00047                 for ( i=0;i<w.length();i++ ) {mu+=w ( i ) *Coms ( i )->mean(); }
    00048                 return mu;
    00049         }
    00050         double evalpdflog ( const vec &val ) const {int i; double sum=0.0; for ( i=0;i<w.length();i++ ) {sum+=w ( i ) *Coms ( i )->evalpdflog ( val );} return log ( sum );};
    00051
    00052 //Access methods
    00054         vec& _w() {return w;}
    00055 };
    00056
    00057
    00058 #endif //MX_H