Changeset 338 for bdm/stat/libBM.h
- Timestamp:
- 05/06/09 15:25:59 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/stat/libBM.h
r325 r338 513 513 //! log this vector 514 514 virtual void logit ( int id, const vec &v ) =0; 515 //! log this double 516 virtual void logit ( int id, const double &d ) =0; 515 517 516 518 //! Shifts storage position for another time step. … … 640 642 //! @{ 641 643 642 BM () :ll ( 0 ),evalll ( true ), LIDs ( 3 ), opt_L_bounds ( false ) {}; 644 BM () :ll ( 0 ),evalll ( true ), LIDs ( 4 ), LFlags(4) { 645 LIDs=-1;/*empty IDs*/ LFlags=0; LFlags(0)=1;/*log only mean*/}; 643 646 BM ( const BM &B ) : drv ( B.drv ), ll ( B.ll ), evalll ( B.evalll ) {} 644 647 //! Copy function required in vectors, Arrays of BM etc. Have to be DELETED manually! … … 699 702 //!@{ 700 703 701 //! Set boolean options from a string 704 //! Set boolean options from a string recognized are: "logbounds,logll" 702 705 virtual void set_options ( const string &opt ) { 703 opt_L_bounds= ( opt.find ( "logbounds" ) !=string::npos ); 704 } 705 //! IDs of storages in loggers 706 LFlags(0)=1; 707 if ( opt.find ( "logbounds" ) !=string::npos ) {LFlags(1)=1; LFlags(2)=1;} 708 if ( opt.find ( "logll" ) !=string::npos ) {LFlags(3)=1;} 709 } 710 //! IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll] 706 711 ivec LIDs; 707 712 708 //! Option for logging bounds709 bool opt_L_bounds;713 //! Flags for logging - same size as LIDs, each entry correspond to the same in LIDs 714 ivec LFlags; 710 715 //! Add all logged variables to a logger 711 716 virtual void log_add ( logger &L, const string &name="" ) { … … 716 721 717 722 // Add mean value 718 LIDs ( 0 ) =L.add ( r,name ); 719 if ( opt_L_bounds ) { 720 LIDs ( 1 ) =L.add ( r,name+"_lb" ); 721 LIDs ( 2 ) =L.add ( r,name+"_ub" ); 722 } 723 if (LFlags(0)) LIDs ( 0 ) =L.add ( r,name ); 724 if (LFlags(1)) LIDs ( 1 ) =L.add ( r,name+"_lb" ); 725 if (LFlags(2)) LIDs ( 2 ) =L.add ( r,name+"_ub" ); 726 if (LFlags(3)) LIDs ( 3 ) =L.add ( RV("ll",1,0),r.name(0)+name ); //TODO: "local" RV 723 727 } 724 728 virtual void logit ( logger &L ) { 725 729 L.logit ( LIDs ( 0 ), posterior().mean() ); 726 if ( opt_L_bounds ) {730 if ( LFlags(1) || LFlags(2)) { //if one of them is off, its LID==-1 and will not be stored 727 731 vec ub,lb; 728 732 posterior().qbounds ( lb,ub ); 729 L.logit ( LIDs ( 1 ), lb ); 733 L.logit ( LIDs ( 1 ), lb ); 730 734 L.logit ( LIDs ( 2 ), ub ); 731 735 } 736 if (LFlags(3)) L.logit ( LIDs ( 3 ), ll ); 732 737 } 733 738 //!@}