- Timestamp:
- 04/08/10 16:01:03 (15 years ago)
- Location:
- library/bdm
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/bdmbase.h
r889 r895 915 915 //! size of data 916 916 int utsize; 917 //!size of output918 int ytsize;919 917 //!Description of data returned by \c getdata(). 920 918 RV Drv; 921 919 //!Description of data witten by by \c write(). 922 920 RV Urv; // 923 //!Description of output data924 RV Yrv; //925 921 public: 926 922 //! default constructors 927 DS() : dtsize ( 0 ), utsize ( 0 ), ytsize ( 0 ), Drv(), Urv(), Yrv(){923 DS() : dtsize ( 0 ), utsize ( 0 ), Drv(), Urv(){ 928 924 log_level[dt] = true; 929 925 }; … … 964 960 return Urv; 965 961 } 966 //!access function967 const RV& _yrv() const {968 return Yrv;969 }970 962 //! set random variables 971 virtual void set_drv ( const RV &yrv, const RV &urv ) { 972 Yrv = yrv; 973 Drv = concat ( yrv, urv ); 963 virtual void set_drv ( const RV &drv, const RV &urv) { 964 Drv = drv; 974 965 Urv = urv; 975 966 } -
library/bdm/base/datasources.cpp
r892 r895 63 63 64 64 void PdfDS::getdata ( vec &dt_out ) const { 65 bdm_assert_debug ( dt_out.length() >= utsize + ytsize, "Short output vector" );65 bdm_assert_debug ( dt_out.length() >= dtsize, "Short output vector" ); 66 66 dt_out.set_subvector ( 0, yt ); 67 dt_out.set_subvector ( yt size, ut );67 dt_out.set_subvector ( yt.length(), ut ); 68 68 } 69 69 … … 82 82 dt.set_subvector ( 0, yt ); 83 83 dt.set_subvector ( yt.length(), xt ); 84 dt.set_subvector ( yt size, ut );84 dt.set_subvector ( yt.length()+xt.length(), ut ); 85 85 } 86 86 … … 99 99 DS::validate(); 100 100 101 Yrv = concat ( OM->_rv() , IM->_rv() ); // export also true state102 ytsize = Yrv._dsize();101 RV Yrv = concat ( OM->_rv() , IM->_rv() ); // export also true state 102 int ytsize = Yrv._dsize(); 103 103 104 104 RV tmp = concat ( OM->_rvc(), IM->_rvc() ); // what i not in rvc -
library/bdm/base/datasources.h
r892 r895 97 97 set_drv ( *r, RV() ); //empty urv 98 98 dtsize = r->_dsize(); 99 ytsize = dtsize;100 99 utsize = 0; 101 100 } … … 219 218 dt = zeros ( iepdf->dimension() ); 220 219 dtsize = dt.length(); 221 ytsize = dt.length();222 220 set_drv ( iepdf->_rv(), RV() ); 223 221 utsize = 0; … … 281 279 ipdf = UI::build<pdf> ( set, "pdf", UI::compulsory ); 282 280 283 Yrv = ipdf->_rv();281 RV Yrv = ipdf->_rv(); 284 282 // get unique rvs form rvc 285 283 RV rgrv0 = ipdf->_rvc().remove_time(); 286 284 // input is what in not in Yrv 287 285 Urv = rgrv0.subt ( Yrv ); 288 set_drv ( Yrv, Urv );286 set_drv ( concat(Yrv,Urv), Urv ); 289 287 // connect input and output to rvc 290 288 ut2rgr.set_connection ( ipdf->_rvc(), Urv ); … … 308 306 ut = zeros ( Urv._dsize() ); 309 307 310 ytsize = yt.length();311 308 utsize = ut.length(); 312 dtsize = yt size+ utsize;309 dtsize = yt.length() + utsize; 313 310 } 314 311 -
library/bdm/mex/mex_datasource.h
r766 r895 45 45 rowid = linspace ( 0, Data.rows() - 1 ); 46 46 dtsize = rowid.length(); 47 ytsize = rowid.length();48 47 utsize = 0; 49 48 … … 87 86 mexDS () : DS() {}; 88 87 89 /*! \brief Create memory data source from mxArray88 /*! \brief Data source computed by matlab function 90 89 91 90 \code … … 94 93 step_name=""; // name of function to call 95 94 input_name=""; // name of workspace variable where inputs are written 96 yrv = {class='RV',...} // identification of outputs95 drv = {class='RV',...} // identification of outputs 97 96 urv = {class='RV',...} // identification of inputs 98 97 }; … … 106 105 UI::get ( input_name, set, "input_name", UI::compulsory ); 107 106 108 shared_ptr<RV> r y = UI::build<RV> ( set, "yrv", UI::compulsory );107 shared_ptr<RV> rd = UI::build<RV> ( set, "drv", UI::compulsory ); 109 108 shared_ptr<RV> ru = UI::build<RV> ( set, "urv", UI::compulsory ); 110 109 111 ytsize = ry->_dsize();110 dtsize = rd->_dsize(); 112 111 utsize = ru->_dsize(); 113 dtsize = ytsize + utsize;114 112 115 set_drv ( *r y, *ru );113 set_drv ( *rd, *ru ); 116 114 validate(); 117 115 } … … 142 140 mexCallMATLAB ( 1, &tmp, 0, ( mxArray ** ) &dummy, step_name.c_str() ); 143 141 // save its results 144 bdm_assert_debug ( ( int ) mxGetM ( tmp ) == ytsize || ( int ) mxGetN ( tmp ) == ytsize, "mexDS.step() expected return vector of length " + num2str ( dtsize ) +142 bdm_assert_debug ( ( int ) mxGetM ( tmp ) == dtsize || ( int ) mxGetN ( tmp ) == dtsize, "mexDS.step() expected return vector of length " + num2str ( dtsize ) + 145 143 "got vector " + num2str ( ( int ) mxGetM ( tmp ) ) + "x" + num2str ( ( int ) mxGetN ( tmp ) ) ); 146 144 //write y 147 145 dt.set_subvector ( 0, mxArray2vec ( tmp ) ); 148 146 //write u 149 dt.set_subvector ( ytsize, ut );150 147 } 151 148 void write ( const vec &ut0 ) { -
library/bdm/mex/mex_logger.h
r737 r895 62 62 istart = 0; 63 63 for ( int j = 0; j < entries ( i ).length(); j++ ) { // same for as in add!!! 64 vec_name = names ( i ) + prefix_sep()+ entries ( i ).name ( j );64 vec_name = names ( i ) + "_" + entries ( i ).name ( j ); 65 65 iend = istart + entries ( i ).size ( j ) - 1; 66 66 M = vectors ( i ).get_cols ( istart, iend );