- Timestamp:
- 01/14/10 21:37:57 (15 years ago)
- Location:
- library/bdm
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/itpp_ext.cpp
r766 r787 390 390 void triu ( mat &A ) { 391 391 for ( int i = 1; i < A.rows(); i++ ) { // row cycle 392 for ( int j = 0; j < i; j++ ) {392 for ( int j = 0; (j < i) && (j<A.cols()); j++ ) { 393 393 A ( i, j ) = 0; 394 394 } -
library/bdm/mpdm/arx_agent.h
r776 r787 65 65 } 66 66 void adapt(const vec &glob_dt){ 67 dlDt.filldown(glob_dt, dt); 67 dlDt.filldown(glob_dt, dt); 68 dlDt.store_data(glob_dt); // do not ever use dlDt again! 69 68 70 lqg_arx->adapt(dt); 69 71 // remove old predictors … … 80 82 merger->merge(); 81 83 enorm<chmat> joint_pred; 82 joint_pred.set_parameters(merger->mean(), merger->covariance()); 84 mat Cov=merger->covariance(); 85 if (sumsum(Cov)==0.0){ 86 bdm_error("merging failed"); 87 } 88 joint_pred.set_parameters(merger->mean(), Cov); 83 89 joint_pred.set_rv(merger->_rv()); 84 90 … … 96 102 ut=lqg_arx->ctrlaction(dt); 97 103 dlU.filldown(ut,glob_ut); 98 // save dat for next time99 dlDt.store_data(dt);100 104 } 101 105 virtual void ds_register(const DS &ds){ -
library/bdm/stat/merger.cpp
r773 r787 163 163 mat Tmp = zeros ( dim, dim ); 164 164 for ( int i = 0; i < Npoints; i++ ) { 165 Tmp += w ( i ) * outer_product ( S ( i ), S ( i ) ); 166 } 167 return Tmp - outer_product ( mea, mea ); 165 vec tmp=S ( i )-mea; //inefficient but numerically stable 166 Tmp += w ( i ) * outer_product (tmp , tmp ); 167 } 168 return Tmp; 168 169 } 169 170 … … 174 175 void merger_mix::merge ( ) { 175 176 if(Npoints<1){ 176 set_support(enorm<fsqmat>(zeros(dim), eye(dim)), 100 );177 set_support(enorm<fsqmat>(zeros(dim), eye(dim)), 1000); 177 178 } 178 179