Changeset 889 for library/bdm

Show
Ignore:
Timestamp:
03/30/10 00:01:05 (14 years ago)
Author:
mido
Message:

redesign of logger::add_vector, and a few small patches.. however, applications WERE NOT ADJUSTED yet

Location:
library/bdm
Files:
5 modified

Legend:

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

    r881 r889  
    426426} 
    427427 
    428 int logger::add_vector ( const RV &rv, string prefix ) { 
     428int logger::add_vector ( const RV &rv, const string &prefix, const string &name ) { 
    429429        int id; 
    430430        if ( rv._dsize() > 0 ) { 
    431431                id = entries.length(); 
    432432                names = concat ( names, prefix ); // diff 
     433                if( name.length() > 0 ) 
     434                { 
     435                        concat( names, separator ); 
     436                        concat( names, name ); 
     437                } 
    433438                entries.set_length ( id + 1, true ); 
    434439                entries ( id ) = rv; 
     
    468473                logrec->ids.set_size ( 3 ); 
    469474                if ( log_level[logmean] ) { 
    470                         logrec->ids ( 0 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "mean" ); 
     475                        logrec->ids ( 0 ) = logrec->L.add_vector ( r, prefix, "mean" ); 
    471476                } 
    472477                if ( log_level[loglbound]  ) { 
    473                         logrec->ids ( 1 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "lb" ); 
     478                        logrec->ids ( 1 ) = logrec->L.add_vector ( r, prefix, "lb" ); 
    474479                }        
    475480                if ( log_level[logubound]  ) { 
    476                         logrec->ids ( 2 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "ub" ); 
     481                        logrec->ids ( 2 ) = logrec->L.add_vector ( r, prefix, "ub" ); 
    477482                } 
    478483         
     
    561566        if ( log_level.any() ) { 
    562567                logrec->ids.set_size ( 1 ); 
    563                 logrec->ids ( 0) = L.add_vector ( RV ( "", 1 ), prefix + L.prefix_sep() + "ll" ); 
     568                logrec->ids ( 0) = L.add_vector ( RV ( "", 1 ), prefix, "ll" ); 
    564569        } 
    565570         
     
    571576                prior().log_level[epdf::logfull]=true; 
    572577        } 
    573         const_cast<epdf&> ( posterior() ).log_register ( L, prefix + L.prefix_sep() + "apost" ); 
     578        const_cast<epdf&> ( posterior() ).log_register ( L, prefix + L.separator + "apost" ); 
    574579} 
    575580 
  • library/bdm/base/bdmbase.h

    r871 r889  
    306306        //! Names of logged quantities, e.g. names of algorithm variants 
    307307        Array<string> names; 
    308         //!separator of prefixes of entries 
    309         const string separator; 
    310308        //! Root Setting for storing Settings 
    311309        Config setting_conf; 
     
    316314        logger ( const string separator0 ) : entries ( 0 ), names ( 0 ), separator ( separator0 ) {} 
    317315 
     316        //!separator of prefixes of entries 
     317        //! 
     318        //! It is a constant string, thus it can be safely declared as public without creating any accessor method 
     319        const string separator; 
     320 
     321 
    318322        //! returns an identifier which will be later needed for calling the \c logit() function 
    319323        //! For empty RV it returns -1, this entry will be ignored by \c logit(). 
    320         virtual int add_vector ( const RV &rv, string prefix = "" ); 
     324        virtual int add_vector ( const RV &rv, const string &prefix, const string &name = "" ); 
    321325 
    322326        virtual int add_setting ( const string &prefix ); 
     
    339343        //! Initialize the storage 
    340344        virtual void init() {}; 
    341  
    342         //!separator of prefixes for this logger 
    343         const string& prefix_sep() { 
    344                 return separator; 
    345         } 
    346345}; 
    347346 
     
    512511 
    513512        The following constructors should be supported for convenience: 
    514         \li constructor followed by calling \c set_parameters() 
     513        \li constructor followed by calling \c set_parameters() WHICH IS OBSOLETE (TODO) 
    515514        \li constructor accepting random variables calling \c set_rv() 
    516515 
    517          All internal data structures are constructed as empty. Their values (including sizes) will be set by method \c set_parameters(). This way references can be initialized in constructors. 
     516         All internal data structures are constructed as empty. Their values (including sizes) will be  
     517         set by method \c set_parameters() WHICH IS OBSOLETE (TODO). This way references can be initialized in constructors. 
    518518        @{*/ 
    519519        epdf() {}; 
  • library/bdm/estim/kalman.h

    r863 r889  
    422422 
    423423}; 
    424  
    425424UIREGISTER ( MultiModel ); 
    426425SHAREDPTR ( MultiModel ); 
  • library/bdm/stat/exp_family.cpp

    r887 r889  
    302302                logrec->ids.set_length ( 2 ); 
    303303                int th_dim = dimension() - dimx * ( dimx + 1 ) / 2; 
    304                 logrec->ids ( 0 ) = L.add_vector ( RV ( "", th_dim ), prefix + logrec->L.prefix_sep() + "mean" ); 
    305                 logrec->ids ( 1 ) = L.add_vector ( RV ( "", th_dim * th_dim ), prefix + logrec->L.prefix_sep() + "variance" ); 
     304                logrec->ids ( 0 ) = L.add_vector ( RV ( "", th_dim ), prefix, "mean" ); 
     305                logrec->ids ( 1 ) = L.add_vector ( RV ( "", th_dim * th_dim ), prefix, "variance" ); 
    306306        } else { 
    307307                epdf::log_register ( L, prefix ); 
  • library/bdm/stat/exp_family.h

    r887 r889  
    451451        rv = RV({'name'})         // description of RV 
    452452        rvc = RV({'name'})        // description of RV in condition 
     453        log_level = 'tri';                // set the level of logged details 
    453454        \endcode 
     455 
     456        \sa log_level_enums 
    454457        */ 
    455  
    456458        void from_setting ( const Setting &set ) { 
    457459                epdf::from_setting ( set );