Changeset 693 for library/bdm/base/bdmbase.h
- Timestamp:
- 11/02/09 17:27:29 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/bdmbase.h
r690 r693 386 386 387 387 //! Conditional probability density, e.g. modeling \f$ f( x | y) \f$, where \f$ x \f$ is random variable, \c rv, and \f$ y \f$ is conditioning variable, \c rvc. 388 class mpdf : public root {388 class pdf : public root { 389 389 protected: 390 390 //!dimension of the condition … … 403 403 //! @{ 404 404 405 mpdf() : dimc ( 0 ), rvc(), dim(0), rv() { }406 407 mpdf ( const mpdf &m ) : dimc ( m.dimc ), rvc ( m.rvc ), dim( m.dim), rv( m.rv ) { }405 pdf() : dimc ( 0 ), rvc(), dim(0), rv() { } 406 407 pdf ( const pdf &m ) : dimc ( m.dimc ), rvc ( m.rvc ), dim( m.dim), rv( m.rv ) { } 408 408 409 409 //! copy of the current object - make sure to implement 410 virtual mpdf* _copy_() const {return new mpdf(*this);}410 virtual pdf* _copy_() const {return new pdf(*this);} 411 411 //!@} 412 412 … … 467 467 //! Load from structure with elements: 468 468 //! \code 469 //! { class = " mpdf_offspring",469 //! { class = "pdf_offspring", 470 470 //! rv = {class="RV", names=(...),}; // RV describing meaning of random variable 471 471 //! rvc= {class="RV", names=(...),}; // RV describing meaning of random variable in condition … … 491 491 //!@} 492 492 }; 493 SHAREDPTR ( mpdf );493 SHAREDPTR ( pdf ); 494 494 495 495 //! Probability density function with numerical statistics, e.g. posterior density. 496 class epdf : public mpdf {496 class epdf : public pdf { 497 497 498 498 public: … … 509 509 @{*/ 510 510 epdf() {}; 511 epdf ( const epdf &e ) : mpdf(e) {};511 epdf ( const epdf &e ) : pdf(e) {}; 512 512 void set_parameters ( int dim0 ) { 513 513 dim = dim0; … … 542 542 543 543 //! Return conditional density on the given RV, the remaining rvs will be in conditioning 544 virtual shared_ptr< mpdf> condition ( const RV &rv ) const;544 virtual shared_ptr<pdf> condition ( const RV &rv ) const; 545 545 546 546 //! Return marginal density on the given RV, the remainig rvs are intergrated out … … 633 633 SHAREDPTR ( epdf ); 634 634 635 //! Mpdf with internal epdf that is modified by function \c condition635 //! pdf with internal epdf that is modified by function \c condition 636 636 template <class EPDF> 637 class mpdf_internal: public mpdf {637 class pdf_internal: public pdf { 638 638 protected : 639 639 //! Internal epdf used for sampling … … 641 641 public: 642 642 //! constructor 643 mpdf_internal() : mpdf(), iepdf() {643 pdf_internal() : pdf(), iepdf() { 644 644 // set_ep ( iepdf ); TODO! 645 645 } 646 646 647 //! Update \c iepdf so that it represents this mpdf conditioned on \c rvc = cond647 //! Update \c iepdf so that it represents this pdf conditioned on \c rvc = cond 648 648 //! This function provides convenient reimplementation in offsprings 649 649 virtual void condition ( const vec &cond ) { … … 896 896 }; 897 897 898 //!DataLink is a connection between mpdf and its superordinate (Up)898 //!DataLink is a connection between pdf and its superordinate (Up) 899 899 //! This class links 900 900 class datalink_m2m: public datalink_m2e { … … 928 928 929 929 930 //! \brief Combines RVs from a list of mpdfs to a single one.931 RV get_composite_rv ( const Array<shared_ptr< mpdf> > &mpdfs, bool checkoverlap = false );930 //! \brief Combines RVs from a list of pdfs to a single one. 931 RV get_composite_rv ( const Array<shared_ptr<pdf> > &pdfs, bool checkoverlap = false ); 932 932 933 933 /*! \brief Abstract class for discrete-time sources of data. … … 1118 1118 }; 1119 1119 //!Constructs conditional density of 1-step ahead predictor \f$ f(d_{t+1} |d_{t+h-1}, \ldots d_{t}) \f$ 1120 virtual mpdf* predictor() const {1120 virtual pdf* predictor() const { 1121 1121 bdm_error ( "Not implemented" ); 1122 1122 return NULL; … … 1229 1229 //! array of pointers to epdf 1230 1230 typedef Array<shared_ptr<epdf> > epdf_array; 1231 //! array of pointers to mpdf1232 typedef Array<shared_ptr< mpdf> > mpdf_array;1231 //! array of pointers to pdf 1232 typedef Array<shared_ptr<pdf> > pdf_array; 1233 1233 1234 1234 template<class EPDF> 1235 vec mpdf_internal<EPDF>::samplecond ( const vec &cond ) {1235 vec pdf_internal<EPDF>::samplecond ( const vec &cond ) { 1236 1236 condition ( cond ); 1237 1237 vec temp = iepdf.sample(); … … 1240 1240 1241 1241 template<class EPDF> 1242 mat mpdf_internal<EPDF>::samplecond_m ( const vec &cond, int N ) {1242 mat pdf_internal<EPDF>::samplecond_m ( const vec &cond, int N ) { 1243 1243 condition ( cond ); 1244 1244 mat temp ( dimension(), N ); … … 1253 1253 1254 1254 template<class EPDF> 1255 double mpdf_internal<EPDF>::evallogcond ( const vec &yt, const vec &cond ) {1255 double pdf_internal<EPDF>::evallogcond ( const vec &yt, const vec &cond ) { 1256 1256 double tmp; 1257 1257 condition ( cond ); … … 1261 1261 1262 1262 template<class EPDF> 1263 vec mpdf_internal<EPDF>::evallogcond_m ( const mat &Yt, const vec &cond ) {1263 vec pdf_internal<EPDF>::evallogcond_m ( const mat &Yt, const vec &cond ) { 1264 1264 condition ( cond ); 1265 1265 return iepdf.evallog_m ( Yt ); … … 1267 1267 1268 1268 template<class EPDF> 1269 vec mpdf_internal<EPDF>::evallogcond_m ( const Array<vec> &Yt, const vec &cond ) {1269 vec pdf_internal<EPDF>::evallogcond_m ( const Array<vec> &Yt, const vec &cond ) { 1270 1270 condition ( cond ); 1271 1271 return iepdf.evallog_m ( Yt );