Changeset 863 for library

Show
Ignore:
Timestamp:
03/12/10 13:34:17 (14 years ago)
Author:
smidl
Message:

Correction to new log_level -- FIXME - wrong parsing of array<string> in LOG_LEVEL

Location:
library/bdm
Files:
5 modified

Legend:

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

    r854 r863  
    461461 
    462462        // log full data 
    463         if ( log_level[deset] ) { 
     463        if ( log_level[logfull] ) { 
    464464                logrec->ids.set_size ( 1 ); 
    465465                logrec->ids ( 0 ) = logrec->L.add_setting ( prefix ); 
     
    467467                // log only 
    468468                logrec->ids.set_size ( 3 ); 
    469                 if ( log_level.any() ) { 
     469                if ( log_level[logmean] ) { 
    470470                        logrec->ids ( 0 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "mean" ); 
    471                         if ( !log_level[jedna]  ) { 
    472                                 logrec->ids ( 1 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "lb" ); 
    473                                 logrec->ids ( 2 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "ub" ); 
    474                         } 
    475                 } 
     471                } 
     472                if ( log_level[loglb]  ) { 
     473                        logrec->ids ( 1 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "lb" ); 
     474                }        
     475                if ( log_level[logub]  ) { 
     476                        logrec->ids ( 2 ) = logrec->L.add_vector ( r, prefix + logrec->L.prefix_sep() + "ub" ); 
     477                } 
     478         
    476479        } 
    477480} 
    478481 
    479482void epdf::log_write() const { 
    480         if ( log_level[deset] ) { 
     483        if ( log_level[logfull] ) { 
    481484                UI::save(this,  logrec->L.log_to_setting ( logrec->ids ( 0 ) ) ); 
    482485        } else { 
    483                 if ( log_level.any() ) { 
     486                if ( log_level[logmean] ) { 
    484487                        logrec->L.log_vector ( logrec->ids ( 0 ), mean() ); 
    485                         if ( !log_level[jedna]  ) { 
     488                } 
     489                if ( log_level[loglb] || log_level[logub] ) { 
    486490                                vec lb; 
    487491                                vec ub; 
    488492                                qbounds ( lb, ub ); 
    489                                 logrec->L.log_vector ( logrec->ids ( 1 ), lb ); 
    490                                 logrec->L.log_vector ( logrec->ids ( 2 ), ub ); 
     493                                if (log_level[loglb]) 
     494                                        logrec->L.log_vector ( logrec->ids ( 1 ), lb ); 
     495                                if (log_level[logub]) 
     496                                        logrec->L.log_vector ( logrec->ids ( 2 ), ub ); 
    491497                        } 
    492498                } 
    493499        } 
    494 } 
     500 
    495501 
    496502void datalink_buffered::set_connection ( const RV &rv, const RV &rv_up ) { 
     
    552558        root::log_register ( L, prefix ); 
    553559 
    554         const_cast<epdf&> ( posterior() ).log_register ( L, prefix + L.prefix_sep() + "apost" ); 
    555  
    556560        if ( log_level.any() ) { 
    557561                logrec->ids.set_size ( 1 ); 
    558                 logrec->ids ( likelihood ) = L.add_vector ( RV ( "", 1 ), prefix + L.prefix_sep() + "ll" ); 
    559         } 
     562                logrec->ids ( 0) = L.add_vector ( RV ( "", 1 ), prefix + L.prefix_sep() + "ll" ); 
     563        } 
     564         
     565        if (log_level[bounds]){ 
     566                prior().log_level[epdf::loglb]=true; 
     567                prior().log_level[epdf::logub]=true; 
     568        } 
     569        if (log_level[full]){ 
     570                prior().log_level[epdf::logfull]=true; 
     571        } 
     572        const_cast<epdf&> ( posterior() ).log_register ( L, prefix + L.prefix_sep() + "apost" ); 
    560573} 
    561574 
     
    563576        posterior().log_write(); 
    564577        if ( log_level.any() ) { 
    565                 logrec->L.logit ( logrec->ids ( likelihood ), ll ); 
     578                logrec->L.logit ( logrec->ids ( 0 ), ll ); 
    566579        } 
    567580} 
  • library/bdm/base/user_info.h

    r850 r863  
    312312                UI::get( true_options, element ); 
    313313                for( int i = 0; i < true_options.length(); i++ ) 
    314                         for( int j = 0; j < options.names().length(); j++ ) 
     314                        for( int j = 0; j < options.names().length(); j++ ){ 
    315315                                if( true_options(i) == options.names()(j)  )  
    316316                                { 
     
    318318                                        break; 
    319319                                }  
     320                        } 
    320321        } 
    321322 
  • library/bdm/bdmroot.h

    r853 r863  
    7676 
    7777// MUZEME INTERNE POUZIVAT ENUMY, A KLIDNE MENIT JEJICH PORADI, DIKY TOMUHLE MAKRU SE VZDY NAMAPUJI NA TY SPRAVNE STRINGY  
    78 #define LOG_LEVEL(CLASSNAME,...) private: friend class logged_options<CLASSNAME>; static const Array<string> &option_names() { static const Array<string> option_names( "{"#__VA_ARGS__"}" ); return option_names; }; public: enum possible_options { __VA_ARGS__ }; logged_options<CLASSNAME> log_level; 
     78#define LOG_LEVEL(CLASSNAME,...) private: friend class logged_options<CLASSNAME>; static const Array<string> &__option_names() { static const Array<string> option_names( "{"#__VA_ARGS__" }" ); return option_names; }; public: enum possible_options { __VA_ARGS__ }; logged_options<CLASSNAME> log_level; 
    7979 
    8080//forward declaration 
  • library/bdm/estim/kalman.h

    r850 r863  
    155155        } 
    156156 
    157         virtual double logpred ( const vec &yt ) const NOT_IMPLEMENTED(0); 
    158  
    159         virtual epdf* epredictor() const NOT_IMPLEMENTED(NULL); 
    160          
    161         virtual pdf* predictor() const NOT_IMPLEMENTED(NULL); 
    162157}; 
    163158/*! 
     
    426421        void from_setting ( const Setting &set ); 
    427422 
    428         // TODO dodelat void to_setting( Setting &set ) const; 
    429  
    430         virtual double logpred ( const vec &yt ) const NOT_IMPLEMENTED(0);  
    431  
    432         virtual epdf* epredictor() const NOT_IMPLEMENTED(NULL);  
    433  
    434         virtual pdf* predictor() const NOT_IMPLEMENTED(NULL);  
    435423}; 
    436424 
  • library/bdm/mex/mex_BM.h

    r766 r863  
    9999        } //tohle by melo zustat!! 
    100100 
    101         virtual double logpred ( const vec &yt ) const  NOT_IMPLEMENTED(0); 
    102  
    103         virtual epdf* epredictor() const NOT_IMPLEMENTED(NULL); 
    104  
    105         virtual pdf* predictor() const NOT_IMPLEMENTED(NULL); 
    106101}; 
    107102UIREGISTER ( mexBM );