/*! \file \brief Probability distributions for Exponential Family models. \author Vaclav Smidl. ----------------------------------- BDM++ - C++ library for Bayesian Decision Making under Uncertainty Using IT++ for numerical operations ----------------------------------- */ #ifndef EF_H #define EF_H #include //#include using namespace itpp; /*! * \brief General conjugate exponential family posterior density. * More?... */ class eEF :public epdf { public: virtual void tupdate( double phi, mat &vbar, double nubar ){}; virtual void dupdate( mat &v,double nu=1.0 ){}; }; class mEF :public mpdf { public: }; /*! * \brief General exponential family density * More?... */ template class enorm : public eEF { vec mu; sq_T R; public: enorm( RV &rv, vec &mu, sq_T &R ); enorm(); void tupdate( double phi, mat &vbar, double nubar ); void dupdate( mat &v,double nu=1.0 ); vec sample(); double eval( const vec &val ); }; /*! \brief */ template class mlnorm : public mEF { enorm epdf; mat A; public: //! Constructor mlnorm( RV &rv,RV &rvc, mat &A, sq_T &R ); //!Generate one sample of the posterior vec samplecond( vec &cond, double &lik ); mat samplecond( vec &cond, vec &lik, int n ); void condition( vec &cond ); }; //////////////////////// template enorm::enorm( RV &rv, vec &mu0, sq_T &R0 ) { mu = mu0; R = R0; }; template void enorm::dupdate( mat &v, double nu ) { // }; template void enorm::tupdate( double phi, mat &vbar, double nubar ) { // }; template vec enorm::sample() { // }; template double enorm::eval( const vec &val ) { // }; template enorm::enorm() {}; template mlnorm::mlnorm( RV &rv,RV &rvc, mat &A, sq_T &R ) { int dim = rv.length(); vec mu( dim ); epdf = enorm( rv,mu,R ); } template vec mlnorm::samplecond( vec &cond, double &lik ) { this->condition( cond ); vec smp = epdf.sample(); lik = epdf.eval(smp); return smp; } template mat mlnorm::samplecond( vec &cond, vec &lik, int n ) { int i; int dim = rv.length(); mat Smp( dim,n ); vec smp( dim); this->condition( cond ); for ( i=0; i void mlnorm::condition( vec &cond) { } #endif //EF_H