Changeset 565 for library/bdm/estim
- Timestamp:
- 08/19/09 16:54:24 (15 years ago)
- Location:
- library/bdm/estim
- Files:
-
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/estim/arx.cpp
r527 r565 54 54 const ARX* A0 = dynamic_cast<const ARX*> ( B0 ); 55 55 56 it_assert_debug ( V.rows() == A0->V.rows(), "ARX::set_statistics Statistics differ" );56 bdm_assert_debug ( V.rows() == A0->V.rows(), "ARX::set_statistics Statistics differ" ); 57 57 set_statistics ( A0->dimx, A0->V, A0->nu ); 58 58 } … … 80 80 int dim = est.dimension(); 81 81 int dif = V.rows() - dim ;///<----------- TODO 82 it_assert_debug ( ( dif == 0 ) || ( dif == 1 ), "Give RVs do not match" );82 bdm_assert_debug ( ( dif == 0 ) || ( dif == 1 ), "Give RVs do not match" ); 83 83 84 84 mat mu ( dim, V.rows() - dim ); … … 103 103 int dim = est.dimension(); 104 104 int dif = V.rows() - est.dimension();//-------------TODO 105 it_assert_debug ( ( dif == 0 ) || ( dif == 1 ), "Give RVs do not match" );105 bdm_assert_debug ( ( dif == 0 ) || ( dif == 1 ), "Give RVs do not match" ); 106 106 107 107 mat mu ( dim, V.rows() - dim ); -
library/bdm/estim/arx.h
r536 r565 98 98 //! Predictor for empty regressor 99 99 enorm<ldmat>* epredictor() const { 100 it_assert_debug ( dimx == V.rows() - 1, "Regressor is not only 1" );100 bdm_assert_debug ( dimx == V.rows() - 1, "Regressor is not only 1" ); 101 101 return epredictor ( vec_1 ( 1.0 ) ); 102 102 } … … 120 120 drv = drv0; 121 121 } 122 122 123 RV& get_yrv() { 123 124 //if yrv is not ready create it … … 130 131 } 131 132 //yrv should be ready by now 132 it_assert_debug ( _yrv._dsize() == dimx, "incompatible drv" );133 bdm_assert_debug ( _yrv._dsize() == dimx, "incompatible drv" ); 133 134 return _yrv; 134 135 } -
library/bdm/estim/kalman.cpp
r527 r565 11 11 dimy = C0.rows(); 12 12 13 it_assert_debug ( A0.cols() == dimx, "KalmanFull: A is not square" );14 it_assert_debug ( B0.rows() == dimx, "KalmanFull: B is not compatible" );15 it_assert_debug ( C0.cols() == dimx, "KalmanFull: C is not square" );16 it_assert_debug ( ( D0.rows() == dimy ) || ( D0.cols() == dimu ),"KalmanFull: D is not compatible" );17 it_assert_debug ( ( Q0.cols() == dimx ) || ( Q0.rows() == dimx ), "KalmanFull: Q is not compatible" );18 it_assert_debug ( ( R0.cols() == dimy ) || ( R0.rows() == dimy ), "KalmanFull: R is not compatible" );13 bdm_assert_debug ( A0.cols() == dimx, "KalmanFull: A is not square" ); 14 bdm_assert_debug ( B0.rows() == dimx, "KalmanFull: B is not compatible" ); 15 bdm_assert_debug ( C0.cols() == dimx, "KalmanFull: C is not square" ); 16 bdm_assert_debug ( ( D0.rows() == dimy ) || ( D0.cols() == dimu ), "KalmanFull: D is not compatible" ); 17 bdm_assert_debug ( ( Q0.cols() == dimx ) || ( Q0.rows() == dimx ), "KalmanFull: Q is not compatible" ); 18 bdm_assert_debug ( ( R0.cols() == dimy ) || ( R0.rows() == dimy ), "KalmanFull: R is not compatible" ); 19 19 20 20 A = A0; … … 32 32 33 33 void KalmanFull::bayes ( const vec &dt ) { 34 it_assert_debug ( dt.length() == ( dimy + dimu ), "KalmanFull::bayes wrong size of dt" );34 bdm_assert_debug ( dt.length() == ( dimy + dimu ), "KalmanFull::bayes wrong size of dt" ); 35 35 36 36 vec u = dt.get ( dimy, dimy + dimu - 1 ); … … 86 86 87 87 void EKFfull::bayes ( const vec &dt ) { 88 it_assert_debug ( dt.length() == ( dimy + dimu ), "KalmanFull::bayes wrong size of dt" );88 bdm_assert_debug ( dt.length() == ( dimy + dimu ), "EKFull::bayes wrong size of dt" ); 89 89 90 90 vec u = dt.get ( dimy, dimy + dimu - 1 ); … … 142 142 preA.set_submatrix ( dimy, dimy, ( _P._Ch() ) *A.T() ); 143 143 144 // if ( !qr ( preA,Q,postA ) ) it_warning ( "QR in kalman unstable!" );145 144 if ( !qr ( preA, postA ) ) { 146 it_warning ( "QR in kalmanunstable!" );145 bdm_warning ( "QR in KalmanCh unstable!" ); 147 146 } 148 147 … … 217 216 // cout << "_mu:" << _mu <<endl; 218 217 219 // if ( !qr ( preA,Q,postA ) ) it_warning ( "QR in kalman unstable!" );220 218 if ( !qr ( preA, postA ) ) { 221 it_warning ( "QR in kalmanunstable!" );219 bdm_warning ( "QR in EKFCh unstable!" ); 222 220 } 223 221 -
library/bdm/estim/kalman.h
r536 r565 286 286 public: 287 287 void condition ( const vec &QR ) { 288 it_assert_debug ( QR.length() == ( dimx + dimy ), "KFcondRQ: conditioning by incompatible vector" );288 bdm_assert_debug ( QR.length() == ( dimx + dimy ), "KFcondQR: conditioning by incompatible vector" ); 289 289 290 290 Q.setD ( QR ( 0, dimx - 1 ) ); … … 304 304 305 305 void condition ( const vec &R0 ) { 306 it_assert_debug ( R0.length() == ( dimy ), "KFcondR: conditioning by incompatible vector" );306 bdm_assert_debug ( R0.length() == ( dimy ), "KFcondR: conditioning by incompatible vector" ); 307 307 308 308 R.setD ( R0 ); … … 338 338 dimu = B0.cols(); 339 339 340 it_assert_debug ( A0.cols() == dimx, "Kalman: A is not square" );341 it_assert_debug ( B0.rows() == dimx, "Kalman: B is not compatible" );342 it_assert_debug ( C0.cols() == dimx, "Kalman: C is not square" );343 it_assert_debug ( ( D0.rows() == dimy ) || ( D0.cols() == dimu ), "Kalman: D is not compatible" );344 it_assert_debug ( ( R0.cols() == dimy ) || ( R0.rows() == dimy ), "Kalman: R is not compatible" );345 it_assert_debug ( ( Q0.cols() == dimx ) || ( Q0.rows() == dimx ), "Kalman: Q is not compatible" );340 bdm_assert_debug ( A0.cols() == dimx, "Kalman: A is not square" ); 341 bdm_assert_debug ( B0.rows() == dimx, "Kalman: B is not compatible" ); 342 bdm_assert_debug ( C0.cols() == dimx, "Kalman: C is not square" ); 343 bdm_assert_debug ( ( D0.rows() == dimy ) || ( D0.cols() == dimu ), "Kalman: D is not compatible" ); 344 bdm_assert_debug ( ( R0.cols() == dimy ) || ( R0.rows() == dimy ), "Kalman: R is not compatible" ); 345 bdm_assert_debug ( ( Q0.cols() == dimx ) || ( Q0.rows() == dimx ), "Kalman: Q is not compatible" ); 346 346 347 347 A = A0; … … 355 355 template<class sq_T> 356 356 void Kalman<sq_T>::bayes ( const vec &dt ) { 357 it_assert_debug ( dt.length() == ( dimy + dimu ), "KalmanFull::bayes wrong size of dt" );357 bdm_assert_debug ( dt.length() == ( dimy + dimu ), "Kalman::bayes wrong size of dt" ); 358 358 359 359 sq_T iRy ( dimy ); … … 439 439 break; 440 440 default: 441 it_error ( "unknown policy" );441 bdm_error ( "unknown policy" ); 442 442 } 443 443 // copy result to all models … … 486 486 template<class sq_T> 487 487 void EKF<sq_T>::bayes ( const vec &dt ) { 488 it_assert_debug ( dt.length() == ( dimy + dimu ), "KalmanFull::bayes wrong size of dt" );488 bdm_assert_debug ( dt.length() == ( dimy + dimu ), "EKF<>::bayes wrong size of dt" ); 489 489 490 490 sq_T iRy ( dimy, dimy ); -
library/bdm/estim/mixtures.cpp
r504 r565 154 154 void MixEF::flatten ( const BMEF* M2 ) { 155 155 const MixEF* Mix2 = dynamic_cast<const MixEF*> ( M2 ); 156 it_assert_debug ( Mix2->n == n, "Different no of coms" );156 bdm_assert_debug ( Mix2->n == n, "Different no of coms" ); 157 157 //Flatten each component 158 158 for ( int i = 0; i < n; i++ ) { -
library/bdm/estim/mixtures.h
r536 r565 61 61 Array<const epdf*> epdfs ( n + 1 ); 62 62 for ( int i = 0; i < Coms.length(); i++ ) { 63 // it_assert_debug(!x,"MixEF::MixEF : Incompatible components");64 63 epdfs ( i ) = & ( Coms ( i )->posterior() ); 65 64 } … … 75 74 BMEF ( ), n ( Coms0.length() ), Coms ( n ), 76 75 weights (), method ( QB ) { 77 // it_assert_debug ( n>0,"MixEF::MixEF : Empty Component list" );78 79 76 for ( int i = 0; i < n; i++ ) { 80 77 Coms ( i ) = ( BMEF* ) Coms0 ( i )->_copy_(); 81 78 } 82 79 build_est(); 83 }; 80 } 81 84 82 //! Constructor of empty mixture 85 83 MixEF () : … … 91 89 MixEF ( const MixEF &M2 ) : BMEF ( ), n ( M2.n ), Coms ( n ), 92 90 weights ( M2.weights ), method ( M2.method ) { 93 // it_assert_debug ( n>0,"MixEF::MixEF : Empty Component list" );94 95 91 for ( int i = 0; i < n; i++ ) { 96 92 Coms ( i ) = M2.Coms ( i )->_copy_(); … … 98 94 build_est(); 99 95 } 96 100 97 //! Initializing the mixture by a random pick of centroids from data 101 98 //! \param Com0 Initial component - necessary to determine its type. -
library/bdm/estim/particles.h
r536 r565 177 177 178 178 vec sample() const { 179 it_error ( "Not implemented" );180 return 0;179 bdm_error ( "Not implemented" ); 180 return vec(); 181 181 } 182 182 183 183 double evallog ( const vec &val ) const { 184 it_error ( "not implemented" );184 bdm_error ( "not implemented" ); 185 185 return 0.0; 186 186 }