Changeset 611

Show
Ignore:
Timestamp:
09/13/09 23:14:26 (15 years ago)
Author:
smidl
Message:

new logger - stdlog - designed for easy debuggint in command line

Files:
3 modified

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/mex/estimator.cpp

    r609 r611  
    131131                L=new mexlog(Ndat); 
    132132                #else 
    133                 L=new memlog(Ndat, "estimator_logger.it"); 
     133                L=new stdlog(); 
    134134                #endif 
    135135        } 
  • library/bdm/base/datasources.h

    r609 r611  
    2323* \brief Memory storage of off-line data column-wise 
    2424 
    25 The data are stored in an internal matrix \c Data . Each column of Data corresponds to one discrete time observation \f$t\f$. Access to this matrix is via indices \c rowid and \c delays. 
     25The data are stored in an internal matrix \c Data . Each column of Data corresponds to one discrete time observation \f$t\f$. Access to this matrix is via indices \c rowid. 
    2626 
    2727The data can be loaded from a file. 
     
    5656                /*! Create object from the following structure 
    5757                \code 
    58                 { class = 'MemDS'; 
     58                { class = "MemDS"; 
    5959                   Data = (...);            // Data matrix or data vector 
    6060                   --- optional --- 
    61                    drv = {class='RV'; ...} // Identification how rows of the matrix Data will be known to others 
     61                   drv = {class="RV"; ...} // Identification how rows of the matrix Data will be known to others 
    6262                   time = 0;               // Index of the first column to user_info, 
    6363                   rowid = [1,2,3...];     // ids of rows to be used 
     
    6868                \code 
    6969                rowid= [0, 1, 2, ...number_of_rows_of_Data]; 
    70                 drv = {names=("0", "1", "2", ..."number_of_rows_of_Data"); 
     70                drv = {names=("ch0", "ch1", "ch2", ..."number_of_rows_of_Data"); 
    7171                      sizes=( 1    1    1 ...); 
    7272                          times=( 0    0    0 ...); 
     
    9393UIREGISTER(MemDS); 
    9494 
    95 /*!  \brief Simulate data from a static pdf 
     95/*!  \brief Simulate data from a static pdf (epdf) 
     96 
    9697Trivial example of a data source, could be used for tests of some estimation algorithms. For example, simulating data from a mixture model and feeding them to mixture model estimators. 
    9798*/ 
     
    119120                /*! 
    120121                \code 
    121                 class = "PdfDS"; 
    122                 epdf = {class="epdf_offspring", ...}// list of points 
     122                class = "EpdfDS"; 
     123                epdf = {class="epdf_offspring", ...}// uncondtitional density to sample from 
    123124                \endcode 
    124125 
     
    126127                void from_setting ( const Setting &set ) { 
    127128                        iepdf=UI::build<epdf> ( set,"epdf",UI::compulsory ); 
    128                         dt = zeros ( iepdf->dimension() ); 
     129                        bdm_assert(iepdf->isnamed(), "Input epdf must be named, check if RV is given correctly"); 
     130                        dt =  iepdf->sample(); 
     131                        dtsize=dt.length(); 
     132                        set_drv(iepdf->_rv(),RV()); 
     133                        utsize =0; 
    129134                } 
    130135}; 
  • library/bdm/base/loggers.h

    r565 r611  
    8989SHAREDPTR ( memlog ); 
    9090 
     91 
     92/*! \brief Simple logger used for debugging 
     93All data records are written out to std from where they could be send to file 
     94*/ 
     95class stdlog: public memlog{ 
     96        public: 
     97                //! default constructor 
     98                stdlog():memlog(1){}; 
     99                 
     100                void init() { 
     101                        memlog::init(); 
     102                        for (int i=0; i<entries.length();i++){ 
     103                                if (entries(i)._dsize()==1) { 
     104                                        cout << names(i) << entries(i).name(0) << "\t"; 
     105                                } 
     106                                else 
     107                                for (int j=0; j<vectors(i).cols(); j++){ 
     108                                        cout << names(i) << entries(i).scalarname(j) << "\t"; 
     109                                } 
     110                        } 
     111                        cout << endl; 
     112                         
     113                         
     114                } 
     115                //!writes everything out 
     116                void step() { 
     117                        for (int i=0; i<vectors.length();i++){ 
     118                                for (int j=0; j<vectors(i).cols(); j++){ 
     119                                        cout << vectors(i)(0,j) << "\t"; 
     120                                } 
     121                        } 
     122                        cout << endl; 
     123                } 
     124                /*! \brief UI for stdlog 
     125                 
     126                TODO dat tam kam patri, a to celej blok 
     127                 
     128                \code 
     129                logger = { 
     130                        class = "stdlog"; // no parameterization needed 
     131                } 
     132                \endcode 
     133                */ 
     134                void from_setting ( const Setting &set ){ 
     135                } 
     136                 
     137}; 
     138UIREGISTER(stdlog); 
     139 
    91140/*! 
    92141* \brief Logging into dirfile with buffer in memory