Changeset 308 for bdm/stat/libDS.h

Show
Ignore:
Timestamp:
04/09/09 09:13:35 (15 years ago)
Author:
dedecius
Message:

libDS.h & libDS.cpp - made 'pseudo'virtual object FileDS, which is a parent of ItppFileDS (the original FileDS) and CsvFileDS (for parsing data from CSV files).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/libDS.h

    r283 r308  
    5050}; 
    5151 
    52 /*! Read Data Matrix from an IT file 
     52/*! Pseudovirtual class for reading data from files 
    5353 
    5454*/ 
     
    5656 
    5757public: 
    58         FileDS ( const string &fname, const string &varname ) :MemDS() { 
    59                 it_file it ( fname ); 
    60                 it << Name ( varname );  
    61                 it >> Data; 
    62                 time =0; 
    63                 //rowid and delays are ignored 
    64         } 
    6558        void getdata ( vec &dt ) { 
    6659                it_assert_debug ( dt.length() ==Data.rows(),"" ); 
     
    7669        int ndat(){return Data.cols();} 
    7770}; 
     71 
     72/*!  
     73* \brief Read Data Matrix from an IT file 
     74 
     75The constructor creates an internal matrix \c Data from an IT++ file. The file is binary and can be made using the IT++ library or the Matlab/Octave function itsave. NB: the data are stored columnwise, i.e. each column contains the data for time \f$t\f$! 
     76 
     77*/ 
     78class ItppFileDS: public FileDS { 
     79 
     80public: 
     81        ItppFileDS ( const string &fname, const string &varname ) :FileDS() { 
     82                it_file it ( fname ); 
     83                it << Name ( varname );  
     84                it >> Data; 
     85                time = 0; 
     86                //rowid and delays are ignored 
     87        } 
     88}; 
     89 
     90/*! 
     91* \brief CSV file data storage 
     92The constructor creates \c Data matrix from the records in a CSV file \c fname. The orientation can be of two types: 
     931. \c BY_COL which is default - the data are stored in columns; one column per time \f$t\f$, one row per data item. 
     942. \c BY_ROW if the data are stored the classical CSV style. Then each column stores the values for data item, for ex. \f$[y_{t} y_{t-1} ...]\f$, one row for each discrete time instant. 
     95 
     96*/ 
     97class CsvFileDS: public FileDS { 
     98 
     99public: 
     100        //! Constructor - create DS from a CSV file. 
     101        CsvFileDS ( const string& fname, const string& orientation = "BY_COL" ); 
     102}; 
     103 
     104 
    78105 
    79106/*!