Changeset 1057 for library

Show
Ignore:
Timestamp:
06/07/10 22:01:06 (14 years ago)
Author:
smidl
Message:

datasources

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/datasources.cpp

    r942 r1057  
    101101} 
    102102 
    103 void StateDS::step() { 
    104         vec imc ( IM->dimensionc() ); 
    105         imc.set_subvector ( 0, xt ); 
    106         u2imc.filldown ( ut, imc ); 
    107         xt = IM->samplecond ( imc ); 
    108  
    109         vec omc ( OM->dimensionc() ); 
    110         omc.set_subvector ( 0, xt ); 
    111         u2omc.filldown ( ut, omc ); 
    112         vec yt; 
    113         yt = OM->samplecond ( omc ); 
    114         //fill all data 
    115         dt.set_subvector ( 0, yt ); 
    116         dt.set_subvector ( yt.length(), xt ); 
    117         dt.set_subvector ( yt.length()+xt.length(), ut ); 
    118 } 
    119  
    120 void StateDS::from_setting ( const Setting & set ) { 
    121         IM = UI::build<pdf> ( set, "IM", UI::compulsory ); 
    122         OM = UI::build<pdf> ( set, "OM", UI::compulsory ); 
    123  
    124         //todo test if IM->rvc contains IM->rv 
    125         //todo test if OM->rvc contains IM->rv 
    126  
    127         UI::get ( xt, set, "x0", UI::optional ); 
    128  
    129 } 
    130  
    131 void StateDS::validate() { 
    132         DS::validate(); 
    133  
    134         RV Yrv = concat ( OM->_rv() , IM->_rv() ); // export also true state 
    135         int ytsize = Yrv._dsize(); 
    136  
    137         RV tmp = concat ( OM->_rvc(), IM->_rvc() ); // what i not in rvc 
    138         Urv = tmp.subt ( Yrv ); // remove dt,xt and 
    139         Urv = Urv.subt ( Yrv.copy_t ( -1 ) ); // remove dt,xt and 
    140         utsize = Urv._dsize(); 
    141  
    142         set_drv ( Yrv, Urv ); 
    143         dtsize = utsize + ytsize; 
    144  
    145         dt.set_length ( dtsize ); 
    146         if ( xt.length() != IM->dimension() ) { 
    147                 xt = zeros ( IM->dimension() ); 
    148         } 
    149         ut.set_length ( Urv._dsize() ); 
    150  
    151         //create data links 
    152         u2imc.set_connection ( IM->_rvc(), Urv ); 
    153         u2omc.set_connection ( OM->_rvc(), Urv ); 
    154 }