Changeset 489 for library/bdm/base/bdmbase.h
- Timestamp:
- 08/08/09 13:43:16 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/bdmbase.h
r488 r489 419 419 ep = &iepdf; 420 420 } 421 void set_ep (epdf *iepdfp) { 422 ep = iepdfp; 423 } 421 424 422 425 public: … … 436 439 437 440 //! Returns \param N samples from the density conditioned on \c cond, \f$x \sim epdf(rv|cond)\f$. \param cond is numeric value of \c rv 438 virtual mat samplecond_m (const vec &cond, int N) {it_error ("Not implemented");return mat();} 441 virtual mat samplecond_m (const vec &cond, int N) { 442 mat M(dimension(), N); 443 for(int i=0;i<N;i++){M.set_col(i, samplecond(cond));} 444 return M; 445 } 439 446 440 447 … … 443 450 444 451 //! Matrix version of evallogcond 445 virtual vec evallogcond_m (const mat &Dt, const vec &cond) {it_error ("Not implemented");return vec (0);} 452 virtual vec evallogcond_m (const mat &Dt, const vec &cond) { 453 vec v(Dt.cols()); 454 for(int i=0;i<Dt.cols();i++){v(i)= evallogcond(Dt.get_col(i),cond);} 455 return v; 456 } 446 457 447 458 //! Array<vec> version of evallogcond … … 718 729 { 719 730 720 shared_ptr<epdf> i pdf;731 shared_ptr<epdf> iepdf; 721 732 public: 722 733 //!Default constructor … … 724 735 725 736 mepdf (shared_ptr<epdf> em) { 726 i pdf = em;727 set_ep (*i pdf.get());737 iepdf = em; 738 set_ep (*iepdf.get()); 728 739 dimc = 0; 729 740 } 730 741 731 742 //! empty 732 void condition (const vec &cond); 743 vec samplecond(const vec &cond){return iepdf->sample();} 744 double evallogcond(const vec &val, const vec &cond){return iepdf->evallog(val);} 733 745 734 746 //! Load from structure with elements: