Show
Ignore:
Timestamp:
06/22/09 13:17:49 (15 years ago)
Author:
smidl
Message:

merging works for merger_mx

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/bdmbase.h

    r392 r395  
    268268  //! Compute log-probability of multiple values argument \c val 
    269269  virtual vec evallog_m(const mat &Val) const { 
    270     vec x(Val.cols()); 
    271     for (int i = 0; i < Val.cols(); i++) {x(i) = evallog(Val.get_col(i)) ;} 
    272     return x; 
     270          vec x(Val.cols()); 
     271          for (int i = 0; i < Val.cols(); i++) {x(i) = evallog(Val.get_col(i)) ;} 
     272          return x; 
     273  } 
     274  //! Compute log-probability of multiple values argument \c val 
     275  virtual vec evallog_m(const Array<vec> &Avec) const { 
     276          vec x(Avec.size()); 
     277          for (int i = 0; i < Avec.size(); i++) {x(i) = evallog(Avec(i)) ;} 
     278          return x; 
    273279  } 
    274280  //! Return conditional density on the given RV, the remaining rvs will be in conditioning 
     
    311317  //! Size of the random variable 
    312318  int dimension() const {return dim;} 
    313   //!@} 
     319  //! Load from structure with elements: 
     320  //!  \code 
     321  //! { rv = {class="RV", names=(...),}; // RV describing meaning of random variable 
     322  //!   // elements of offsprings 
     323  //! } 
     324  //! \endcode 
     325  //!@} 
     326  void from_setting(const Setting &set){ 
     327          if (set.exists("rv")){ 
     328                  RV* r = UI::build<RV>(set,"rv"); 
     329                  set_rv(*r);  
     330                  delete r; 
     331          } 
     332  } 
    314333 
    315334}; 
     
    368387  //! Matrix version of evallogcond 
    369388  virtual vec evallogcond_m(const mat &Dt, const vec &cond) {this->condition(cond); return ep->evallog_m(Dt);}; 
     389  //! Array<vec> version of evallogcond 
     390  virtual vec evallogcond_m(const Array<vec> &Dt, const vec &cond) {this->condition(cond); return ep->evallog_m(Dt);}; 
    370391 
    371392  //! \name Access to attributes 
     
    378399  epdf& _epdf() {return *ep;} 
    379400  epdf* _e() {return ep;} 
     401  //! Load from structure with elements: 
     402  //!  \code 
     403  //! { rv = {class="RV", names=(...),}; // RV describing meaning of random variable 
     404  //!   rvc= {class="RV", names=(...),}; // RV describing meaning of random variable in condition 
     405  //!   // elements of offsprings 
     406  //! } 
     407  //! \endcode 
     408  //!@} 
     409  void from_setting(const Setting &set){ 
     410          if (set.exists("rv")){ 
     411                  RV* r = UI::build<RV>(set,"rv"); 
     412                  set_rv(*r);  
     413                  delete r; 
     414          } 
     415          if (set.exists("rvc")){ 
     416                  RV* r = UI::build<RV>(set,"rvc"); 
     417                  set_rvc(*r);  
     418                  delete r; 
     419          } 
     420  } 
    380421  //!@} 
    381422 
     
    570611public: 
    571612        //!Default constructor 
     613        mepdf(){}; 
    572614        mepdf ( epdf* em, bool owning_ep0=false ) :mpdf ( ) {ep= em ;owning_ep=owning_ep0;dimc=0;}; 
    573615        mepdf (const epdf* em ) :mpdf ( ) {ep=const_cast<epdf*>( em );}; 
    574616        void condition ( const vec &cond ) {} 
    575617        ~mepdf(){if (owning_ep) delete ep;} 
    576 }; 
     618  //! Load from structure with elements: 
     619  //!  \code 
     620  //! { class = "mepdf",          
     621  //!   epdfs = {class="epdfs",...} 
     622  //! } 
     623  //! \endcode 
     624  //!@} 
     625        void from_setting(const Setting &set){ 
     626                epdf* e = UI::build<epdf>(set,"epdf"); 
     627                ep=     e;  
     628                owning_ep=true; 
     629        } 
     630}; 
     631UIREGISTER(mepdf); 
    577632 
    578633//!\brief Chain rule of pdfs - abstract part common for mprod and merger.