- Timestamp:
- 01/28/09 10:01:18 (15 years ago)
- Location:
- bdm
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/CMakeLists.txt
r249 r256 1 1 # Create a library called "bdm" which includes sources from all directories 2 3 #add_subdirectory(config)4 2 5 3 SET(BdmMath math/libDC.cpp math/libDC.h math/chmat.cpp math/chmat.h) -
bdm/stat/libBM.h
r254 r256 26 26 27 27 //! Root class of BDM objects 28 class b ase{};28 class bdmroot{}; 29 29 30 30 //! Structure of RV (used internally), i.e. expanded RVs … … 47 47 */ 48 48 49 class RV : base{49 class RV :public bdmroot{ 50 50 protected: 51 51 //! size = sum of sizes … … 139 139 //! Class representing function \f$f(x)\f$ of variable \f$x\f$ represented by \c rv 140 140 141 class fnc : base{141 class fnc :public bdmroot{ 142 142 protected: 143 143 //! Length of the output vector … … 165 165 //! Probability density function with numerical statistics, e.g. posterior density. 166 166 167 class epdf : base{167 class epdf :public bdmroot { 168 168 protected: 169 169 //! Identified of the random variable … … 217 217 //TODO Samplecond can be generalized 218 218 219 class mpdf {219 class mpdf : public bdmroot{ 220 220 protected: 221 221 //! modeled random variable … … 358 358 }; 359 359 360 //!\brief Abstract composition of pdfs, a basefor specific classes360 //!\brief Abstract composition of pdfs, will be used for specific classes 361 361 //!this abstract class is common to epdf and mpdf 362 362 class compositepdf { … … 381 381 */ 382 382 383 class DS {383 class DS : public bdmroot{ 384 384 protected: 385 385 //!Observed variables, returned by \c getdata(). … … 413 413 */ 414 414 415 class BM {415 class BM :public bdmroot{ 416 416 protected: 417 417 //!Random variable of the posterior … … 473 473 */ 474 474 475 class BMcond : base{475 class BMcond :public bdmroot{ 476 476 protected: 477 477 //! Identificator of the conditioning variable -
bdm/stat/libEF.h
r254 r256 345 345 \f] 346 346 347 Inverse Gamma can be converted to Gamma using \ [347 Inverse Gamma can be converted to Gamma using \f[ 348 348 x\sim iG(a,b) => 1/x\sim G(a,1/b) 349 \ ]349 \f] 350 350 This relation is used in sampling. 351 351 */ -
bdm/uibuilder.cpp
r254 r256 5 5 UImap __uimap__; 6 6 7 void UIexternal::build(Setting &S, void**result) const{7 void UIexternal::build(Setting &S, bdmroot* &result) const{ 8 8 Config C; 9 9 try{ … … 22 22 UIREGISTER(UIexternal); 23 23 24 void UIinternal::build(Setting &S, void**result) const{24 void UIinternal::build(Setting &S, bdmroot* &result) const{ 25 25 try { 26 26 Setting* Stmp = &S; -
bdm/uibuilder.h
r254 r256 2 2 #define UIBUILD 3 3 4 #include "libconfig/libconfig.h++"5 4 #include <itpp/itbase.h> 6 5 #include "stat/libBM.h" 6 #include "libconfig/libconfig.h++" 7 7 8 8 namespace bdm{ … … 76 76 }; 77 77 public: 78 //!Constructor needs to be run only once via REGISTERUI 78 79 UIbuilder(const string &typ){__uimap__.insert(make_pair(typ,this));} 79 virtual void build(Setting &S, void** result) const =0; 80 //! Function building the computational object 81 virtual void build(Setting &S, bdmroot* &result) const =0; 80 82 }; 81 83 … … 83 85 public: 84 86 UIexternal():UIbuilder("external"){} 85 void build(Setting &S, void**result) const;87 void build(Setting &S, bdmroot* &result) const; 86 88 }; 87 89 … … 89 91 public: 90 92 UIinternal():UIbuilder("internal"){} 91 void build(Setting &S, void**result) const;93 void build(Setting &S, bdmroot* &result) const; 92 94 }; 93 95 94 96 //! Prototype of a UI builder. Return value is by the second argument since it allows some type of type checking. 95 97 template<class T> 96 void UIbuild(Setting &S, T**ret){98 void UIbuild(Setting &S, T* &ret){ 97 99 CHECK_UITYPE(S,TypeGroup); 98 100 T* tmp; … … 101 103 102 104 const string typ=S["type"]; 105 103 106 // Find "type" in list of registred UI builders 104 107 UImap::const_iterator iter = __uimap__.find( typ ); 105 108 if( iter == __uimap__.end()) { 109 cout << "UI error" << endl; 106 110 it_error("UI of type \"" + typ + "\" is not registered!"); 107 111 } 108 else { 109 const UIbuilder* is= iter->second; 110 //BUILD the result 111 is->build(S,reinterpret_cast<void**>(&tmp)); 112 } 112 113 const UIbuilder* is= iter->second; 114 //BUILD the result 115 is->build(S,(bdmroot*&)(tmp)); 113 116 // make assignment 114 *ret=tmp;117 ret=tmp; 115 118 }; 116 119