Revision 377, 1.4 kB
(checked in by mido, 16 years ago)
|
1) globalni prejmenovani Setting &root na Setting &set
2) smazani par zastaralych adresaru
3) oprava warningu v doc\local
4) prejmenovani SettingsResolver? na SettingResolver? a drobne vylepseni funkcnosti
5) odstranena duplikace kodu v user_info.cpp
|
Line | |
---|
1 | #include "../bdm/stat/libDS.h" |
---|
2 | #include "mexparse.h" |
---|
3 | |
---|
4 | namespace bdm { |
---|
5 | /*! |
---|
6 | * \brief Memory storage of off-line data column-wise |
---|
7 | |
---|
8 | 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. |
---|
9 | |
---|
10 | The data can be loaded from a file. |
---|
11 | */ |
---|
12 | class MexDS : public MemDS { |
---|
13 | //!Default constructor |
---|
14 | MexDS () {}; |
---|
15 | |
---|
16 | /*! \brief Create memory data source from mxArray |
---|
17 | |
---|
18 | \code |
---|
19 | system={ |
---|
20 | type="mexDS"; |
---|
21 | varname=""; // name of workspace variable |
---|
22 | rids=[1 1 1]; // numbers of data rows |
---|
23 | tds =[0 1 2]; // time delays |
---|
24 | }; |
---|
25 | \endcode |
---|
26 | |
---|
27 | MemDS with the above fields will be created; |
---|
28 | |
---|
29 | \todo Very memory inefficient implementation. The data file is copied 2 times! |
---|
30 | For better implementatin we would need MemDS with pointer to the raw data. Then it could operate directly inside mxArray. |
---|
31 | |
---|
32 | */ |
---|
33 | void from_setting( const Setting &set ) |
---|
34 | { |
---|
35 | Data = mxArray2mat(mexGetVariable("base",set["varname"])); |
---|
36 | UI::get( rowid, set, "rids" ); |
---|
37 | it_assert_debug ( max ( rowid ) <=Data.rows(),"MemDS rowid is too high for given Dat." ); |
---|
38 | |
---|
39 | UI::get( delays, set, "tds" ); |
---|
40 | time = max ( delays ); |
---|
41 | it_assert_debug ( time < Data.cols(),"MemDS delays are too high." ); |
---|
42 | |
---|
43 | RV* r = UI::build<RV>(set,"rv"); |
---|
44 | RV ru=RV(); |
---|
45 | set_rvs(*r,ru); |
---|
46 | } |
---|
47 | |
---|
48 | |
---|
49 | // TODO dodelat void to_setting( Setting &set ) const; |
---|
50 | }; |
---|
51 | |
---|
52 | UIREGISTER(MexDS); |
---|
53 | |
---|
54 | } |
---|