- Main Page
- Related Pages
- Classes
- Files

# work/git/mixpp/bdm/estim/merger.h

Go to the documentation of this file.

    00001
    00013 #ifndef MER_H
    00014 #define MER_H
    00015
    00016 #include <itpp/itbase.h>
    00017 #include "mixef.h"
    00018
    00019 using namespace itpp;
    00020 using std::string;
    00021
    00028 class merger : public compositepdf, public epdf {
    00029 protected:
    00031         MixEF Mix;
    00033         int Ns;
    00035         int Nc;
    00037         double beta;
    00038 public:
    00040         merger ( const Array<mpdf*> &S ) :
    00041                         compositepdf ( S ), epdf ( getrv ( false ) ),
    00042                         Mix ( Array<BMEF*> ( 0 ),vec ( 0 ) )
    00043         {setindices(rv); beta=2.0; Ns=100; Nc=10;}
    00045         void set_parameters ( double beta0, int Ns0, int Nc0 ) {        beta=beta0;Ns=Ns0;Nc=Nc0;}
    00047         void init() {
    00048                 Array<vec> Smps ( n );
    00049                 //Gibbs sampling
    00050                 for ( int i=0;i<n;i++ ) {Smps ( i ) =zeros ( 0 );}
    00051         }
    00053         void merge ( const epdf* g0 );
    00055         void merge () {merge ( & ( Mix._epdf() ) );};
    00056
    00058         vec lognorm_merge ( mat &lW );
    00061         vec sample ( )const { return Mix._epdf().sample();}
    00062         double evalpdflog ( const vec &dt ) const{ vec dtf=zeros(dt.length()+1); dtf.set_subvector(0,dt); return Mix.logpred ( dtf );}
    00063         vec mean()const {return Mix._epdf().mean();}
    00065         virtual ~merger() {};
    00066 };
    00067
    00068
    00069
    00070 #endif // MER_H