Changeset 267 for bdm/stat/libBM.h

Show
Ignore:
Timestamp:
02/11/09 14:15:05 (15 years ago)
Author:
smidl
Message:

samplecond modification

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/libBM.h

    r265 r267  
    234234        public: 
    235235 
    236                 //! Returns a sample from the density conditioned on \c cond, \f$x \sim epdf(rv|cond)\f$. \param cond is numeric value of \c rv \param ll is a return value of log-likelihood of the sample. 
    237                 virtual vec samplecond ( const vec &cond, double &ll ) { 
     236                //! Returns a sample from the density conditioned on \c cond, \f$x \sim epdf(rv|cond)\f$. \param cond is numeric value of \c rv  
     237                virtual vec samplecond ( const vec &cond) { 
    238238                        this->condition ( cond ); 
    239239                        vec temp= ep->sample(); 
    240                         ll=ep->evallog ( temp );return temp; 
     240                        return temp; 
    241241                }; 
    242242                //! 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 \param ll is a return value of log-likelihood of the sample. 
     
    298298 
    299299        */ 
    300  
    301         /*! 
    302         @brief Class for storing results (and semi-results) of an experiment 
    303  
    304         This class abstracts logging of results from implementation. This class replaces direct logging of results (e.g. to files or to global variables) by calling methods of a logger. Specializations of this abstract class for specific storage method are designed. 
    305         */ 
    306         class logger : public bdmroot { 
    307         protected: 
    308                 //! RVs of all logged variables. 
    309                 Array<RV> entries; 
    310                 //! Names of logged quantities, e.g. names of algorithm variants 
    311                 Array<string> names; 
    312         public: 
    313                 //!Default constructor 
    314                 logger ( ) : entries ( 0 ),names ( 0 ) {} 
    315  
    316                 //! returns an identifier which will be later needed for calling the log() function 
    317                 virtual int add ( const RV &rv, string name="" ) { 
    318                         int id=entries.length(); 
    319                         names=concat ( names, name ); // diff 
    320                         entries.set_length ( id+1,true ); 
    321                         entries ( id ) = rv; 
    322                         return id; // identifier of the last entry 
    323                 } 
    324  
    325                 //! log this vector 
    326                 virtual void logit ( int id, const vec &v ) =0; 
    327  
    328                 //! Shifts storage position for another time step. 
    329                 virtual void step() =0; 
    330  
    331                 //! Finalize storing information 
    332                 virtual void finalize() {}; 
    333  
    334                 //! Initialize the storage 
    335                 virtual void init() {}; 
    336  
    337                 //! for future use 
    338                 virtual ~logger() {}; 
    339         }; 
    340  
    341300        class datalink_e2e { 
    342301        protected: 
     
    418377                //! Fill 
    419378 
     379        }; 
     380 
     381        /*! 
     382        @brief Class for storing results (and semi-results) of an experiment 
     383 
     384        This class abstracts logging of results from implementation. This class replaces direct logging of results (e.g. to files or to global variables) by calling methods of a logger. Specializations of this abstract class for specific storage method are designed. 
     385         */ 
     386        class logger : public bdmroot { 
     387                protected: 
     388                //! RVs of all logged variables. 
     389                        Array<RV> entries; 
     390                //! Names of logged quantities, e.g. names of algorithm variants 
     391                        Array<string> names; 
     392                public: 
     393                //!Default constructor 
     394                        logger ( ) : entries ( 0 ),names ( 0 ) {} 
     395 
     396                //! returns an identifier which will be later needed for calling the log() function 
     397                        virtual int add ( const RV &rv, string name="" ) { 
     398                                int id=entries.length(); 
     399                                names=concat ( names, name ); // diff 
     400                                entries.set_length ( id+1,true ); 
     401                                entries ( id ) = rv; 
     402                                return id; // identifier of the last entry 
     403                        } 
     404 
     405                //! log this vector 
     406                        virtual void logit ( int id, const vec &v ) =0; 
     407 
     408                //! Shifts storage position for another time step. 
     409                        virtual void step() =0; 
     410 
     411                //! Finalize storing information 
     412                        virtual void finalize() {}; 
     413 
     414                //! Initialize the storage 
     415                        virtual void init() {}; 
     416 
     417                //! for future use 
     418                        virtual ~logger() {}; 
    420419        }; 
    421420