33 | | public: |
34 | | void getdata(vec &dt); |
35 | | void getdata(vec &dt, ivec &indeces); |
36 | | void linkrvs(RV &drv, RV &urv); |
37 | | void write(vec &ut){it_error("MemDS::write is not supported");} |
38 | | void write(vec &ut,ivec &indexes){it_error("MemDS::write is not supported");} |
39 | | void step(); |
40 | | //!Default constructor |
41 | | MemDS(mat &Dat, ivec &rowid, ivec &delays); |
42 | | }; |
| 27 | The data can be loaded from a file. |
| 28 | */ |
| 29 | class MemDS : public DS { |
| 30 | //! internal matrix of data |
| 31 | mat Data; |
| 32 | //! active column in the Data matrix |
| 33 | int time; |
| 34 | //! vector of rows that are presented in Dt |
| 35 | ivec rowid; |
| 36 | //! vector of delays that are presented in Dt |
| 37 | ivec delays; |
| 38 | |
| 39 | public: |
| 40 | void getdata ( vec &dt ); |
| 41 | void getdata ( vec &dt, const ivec &indeces ); |
| 42 | void linkrvs ( RV &drv, RV &urv ); |
| 43 | void write ( vec &ut ) {it_error ( "MemDS::write is not supported" );} |
| 44 | void write ( vec &ut,ivec &indexes ) {it_error ( "MemDS::write is not supported" );} |
| 45 | void step(); |
| 46 | //!Default constructor |
| 47 | MemDS ( mat &Dat, ivec &rowid, ivec &delays ); |
| 48 | }; |
| 49 | |
| 50 | /*! |
| 51 | \brief Generator of ARX data |
| 52 | |
| 53 | */ |
| 54 | class ArxDS : public DS { |
| 55 | //! Rv of the regressor |
| 56 | RV Rrv; |
| 57 | //! Rv of the history (full regressor) |
| 58 | RV Hrv; |
| 59 | //! Internal storage of results |
| 60 | vec Y; |
| 61 | //! History, ordered as \f$[u_t, y_{t-1 }, u_{t-1}, \ldots]\f$ |
| 62 | vec H; |
| 63 | //! temporary variable for regressor |
| 64 | vec rgr; |
| 65 | //! data link: val = y, cond = u; local = rgr; |
| 66 | datalink_e2e rgrlnk; |
| 67 | //! model of Y - linear Gaussian |
| 68 | mlnorm<chmat> model; |
| 69 | public: |
| 70 | void getdata ( vec &dt ){it_assert_debug(dt.length()==Y.length(),"ArxDS"); |
| 71 | dt=concat(Y,H.left(Urv.count()));}; |
| 72 | void getdata ( vec &dt, const ivec &indexes ){it_assert_debug(dt.length()==Y.length(),"ArxDS"); dt=Y(indexes);}; |
| 73 | void write ( vec &ut ){it_assert_debug(ut.length()==Urv.count(),"ArxDS"); H.set_subvector(0,ut);}; |
| 74 | void write ( vec &ut, const ivec &indexes ){it_assert_debug(ut.length()==Urv.count(),"ArxDS"); set_subvector(H,indexes,ut);}; |
| 75 | void step(); |
| 76 | //!Default constructor |
| 77 | ArxDS ( RV &drv, RV &urv, RV &rrv); |
| 78 | //! Set parameters of the internal model |
| 79 | void set_parameters(const mat &Th0, const vec mu0, const chmat &sqR0) |
| 80 | {model.set_parameters(Th0, mu0, sqR0); }; |
| 81 | }; |