Changeset 660 for library/bdm/estim/particles.h
- Timestamp:
- 10/15/09 00:04:30 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/estim/particles.h
r653 r660 106 106 //!access function 107 107 vec& _lls() { return lls; } 108 //!access function 108 109 RESAMPLING_METHOD _resmethod() const { return resmethod; } 109 //! access function110 //! return correctly typed posterior (covariant return) 110 111 const eEmp& posterior() const {return est;} 111 112 … … 190 191 est.resample(ind,resmethod); 191 192 } 193 //! access function 192 194 Array<vec>& __samples(){return _samples;} 193 195 }; … … 203 205 class MPF : public BM { 204 206 protected: 207 //! particle filter on non-linear variable 205 208 shared_ptr<PF> pf; 209 //! Array of Bayesian models 206 210 Array<BM*> BMs; 207 211 … … 209 213 210 214 class mpfepdf : public epdf { 215 //! pointer to particle filter 211 216 shared_ptr<PF> &pf; 217 //! pointer to Array of BMs 212 218 Array<BM*> &BMs; 213 219 public: 220 //! constructor 214 221 mpfepdf (shared_ptr<PF> &pf0, Array<BM*> &BMs0): epdf(), pf(pf0), BMs(BMs0) { }; 215 222 //! a variant of set parameters - this time, parameters are read from BMs and pf … … 300 307 //! Default constructor. 301 308 MPF () : jest (pf,BMs) {}; 309 //! set all parameters at once 302 310 void set_parameters ( shared_ptr<mpdf> par0, shared_ptr<mpdf> obs0, int n0, RESAMPLING_METHOD rm = SYSTEMATIC ) { 303 311 pf->set_model ( par0, obs0); … … 305 313 BMs.set_length ( n0 ); 306 314 } 315 //! set a prototype of BM, copy it to as many times as there is particles in pf 307 316 void set_BM ( const BM &BMcond0 ) { 308 317 … … 313 322 for ( int i = 0; i < n; i++ ) { 314 323 BMs ( i ) = BMcond0._copy_(); 315 BMs ( i )->condition ( pf->posterior()._sample ( i ) );316 324 } 317 325 }; … … 374 382 } 375 383 jest.read_parameters(); 384 for ( int i = 0; i < pf->__w().length(); i++ ) { 385 BMs ( i )->condition ( pf->posterior()._sample ( i ) ); 386 } 376 387 } 377 388