Show
Ignore:
Timestamp:
08/08/09 13:43:16 (15 years ago)
Author:
smidl
Message:

Mpdf redesing is complet - all tests pass (except mlnorm<chmat> which is irrelevant)

Files:
1 modified

Legend:

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

    r488 r489  
    419419                        ep = &iepdf; 
    420420                } 
     421                void set_ep (epdf *iepdfp) { 
     422                        ep = iepdfp; 
     423                } 
    421424 
    422425        public: 
     
    436439 
    437440                //! 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                } 
    439446 
    440447 
     
    443450 
    444451                //! 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                } 
    446457 
    447458                //! Array<vec> version of evallogcond 
     
    718729{ 
    719730 
    720                 shared_ptr<epdf> ipdf; 
     731                shared_ptr<epdf> iepdf; 
    721732        public: 
    722733                //!Default constructor 
     
    724735 
    725736                mepdf (shared_ptr<epdf> em) { 
    726                         ipdf = em; 
    727                         set_ep (*ipdf.get()); 
     737                        iepdf = em; 
     738                        set_ep (*iepdf.get()); 
    728739                        dimc = 0; 
    729740                } 
    730741 
    731742                //! 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);} 
    733745 
    734746                //! Load from structure with elements: