Show
Ignore:
Timestamp:
01/29/10 19:56:54 (14 years ago)
Author:
smidl
Message:

new objects: mgdirac + mexFnc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/stat/exp_family.h

    r796 r797  
    116116        } 
    117117}; 
     118 
     119/*! Dirac delta density with predefined transformation 
     120 
     121Density of the type:\f[ f(x_t | y_t) = \delta (x_t - g(y_t)) \f] 
     122where \f$ x_t \f$ is the \c rv, \f$ y_t \f$ is the \c rvc and g is a deterministic transformation of class fn. 
     123*/ 
     124class mgdirac: public pdf{ 
     125        protected: 
     126        shared_ptr<fnc> g; 
     127        public: 
     128                vec samplecond(const vec &cond) { 
     129                        bdm_assert_debug(cond.length()==g->dimensionc(),"given cond in not compatible with g"); 
     130                        vec tmp = g->eval(cond); 
     131                        return tmp; 
     132                }  
     133                double evallogcond ( const vec &yt, const vec &cond ){ 
     134                        return std::numeric_limits< double >::max(); 
     135                } 
     136                void from_setting(const Setting& set){ 
     137                        pdf::from_setting(set); 
     138                        g=UI::build<fnc>(set,"g",UI::compulsory); 
     139                        validate(); 
     140                } 
     141                void to_setting(Setting &set) const{ 
     142                        pdf::to_setting(set); 
     143                        UI::save(g.get(), set, "g"); 
     144                } 
     145                void validate() { 
     146                        dim = g->dimension(); 
     147                        dimc = g->dimensionc(); 
     148                } 
     149}; 
     150UIREGISTER(mgdirac); 
     151 
    118152 
    119153template<class sq_T, template <typename> class TEpdf>