Changeset 565 for library/bdm/estim

Show
Ignore:
Timestamp:
08/19/09 16:54:24 (15 years ago)
Author:
vbarta
Message:

using own error macros (basically copied from IT++, but never aborting)

Location:
library/bdm/estim
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/estim/arx.cpp

    r527 r565  
    5454        const ARX* A0 = dynamic_cast<const ARX*> ( B0 ); 
    5555 
    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" ); 
    5757        set_statistics ( A0->dimx, A0->V, A0->nu ); 
    5858} 
     
    8080        int dim = est.dimension(); 
    8181        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" ); 
    8383 
    8484        mat mu ( dim, V.rows() - dim ); 
     
    103103        int dim = est.dimension(); 
    104104        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" ); 
    106106 
    107107        mat mu ( dim, V.rows() - dim ); 
  • library/bdm/estim/arx.h

    r536 r565  
    9898        //! Predictor for empty regressor 
    9999        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" ); 
    101101                return epredictor ( vec_1 ( 1.0 ) ); 
    102102        } 
     
    120120                drv = drv0; 
    121121        } 
     122 
    122123        RV& get_yrv() { 
    123124                //if yrv is not ready create it 
     
    130131                } 
    131132                //yrv should be ready by now 
    132                 it_assert_debug ( _yrv._dsize() == dimx, "incompatible drv" ); 
     133                bdm_assert_debug ( _yrv._dsize() == dimx, "incompatible drv" ); 
    133134                return _yrv; 
    134135        } 
  • library/bdm/estim/kalman.cpp

    r527 r565  
    1111        dimy = C0.rows(); 
    1212 
    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" ); 
    1919 
    2020        A = A0; 
     
    3232 
    3333void 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" ); 
    3535 
    3636        vec u = dt.get ( dimy, dimy + dimu - 1 ); 
     
    8686 
    8787void 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" ); 
    8989 
    9090        vec u = dt.get ( dimy, dimy + dimu - 1 ); 
     
    142142        preA.set_submatrix ( dimy, dimy, ( _P._Ch() ) *A.T() ); 
    143143 
    144 //      if ( !qr ( preA,Q,postA ) ) it_warning ( "QR in kalman unstable!" ); 
    145144        if ( !qr ( preA, postA ) ) { 
    146                 it_warning ( "QR in kalman unstable!" ); 
     145                bdm_warning ( "QR in KalmanCh unstable!" ); 
    147146        } 
    148147 
     
    217216//      cout << "_mu:" << _mu <<endl; 
    218217 
    219 //      if ( !qr ( preA,Q,postA ) ) it_warning ( "QR in kalman unstable!" ); 
    220218        if ( !qr ( preA, postA ) ) { 
    221                 it_warning ( "QR in kalman unstable!" ); 
     219                bdm_warning ( "QR in EKFCh unstable!" ); 
    222220        } 
    223221 
  • library/bdm/estim/kalman.h

    r536 r565  
    286286public: 
    287287        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" ); 
    289289 
    290290                Q.setD ( QR ( 0, dimx - 1 ) ); 
     
    304304 
    305305        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" ); 
    307307 
    308308                R.setD ( R0 ); 
     
    338338        dimu = B0.cols(); 
    339339 
    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" ); 
    346346 
    347347        A = A0; 
     
    355355template<class sq_T> 
    356356void 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" ); 
    358358 
    359359        sq_T iRy ( dimy ); 
     
    439439                break; 
    440440                default: 
    441                         it_error ( "unknown policy" ); 
     441                        bdm_error ( "unknown policy" ); 
    442442                } 
    443443                // copy result to all models 
     
    486486template<class sq_T> 
    487487void 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" ); 
    489489 
    490490        sq_T iRy ( dimy, dimy ); 
  • library/bdm/estim/mixtures.cpp

    r504 r565  
    154154void MixEF::flatten ( const BMEF* M2 ) { 
    155155        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" ); 
    157157        //Flatten each component 
    158158        for ( int i = 0; i < n; i++ ) { 
  • library/bdm/estim/mixtures.h

    r536 r565  
    6161                        Array<const epdf*> epdfs ( n + 1 ); 
    6262                        for ( int i = 0; i < Coms.length(); i++ ) { 
    63 //                      it_assert_debug(!x,"MixEF::MixEF : Incompatible components"); 
    6463                                epdfs ( i ) = & ( Coms ( i )->posterior() ); 
    6564                        } 
     
    7574                        BMEF ( ), n ( Coms0.length() ), Coms ( n ), 
    7675                        weights (), method ( QB ) { 
    77                 //      it_assert_debug ( n>0,"MixEF::MixEF : Empty Component list" ); 
    78  
    7976                for ( int i = 0; i < n; i++ ) { 
    8077                        Coms ( i ) = ( BMEF* ) Coms0 ( i )->_copy_(); 
    8178                } 
    8279                build_est(); 
    83         }; 
     80        } 
     81 
    8482        //! Constructor of empty mixture 
    8583        MixEF () : 
     
    9189        MixEF ( const MixEF &M2 ) : BMEF ( ), n ( M2.n ), Coms ( n ), 
    9290                        weights ( M2.weights ), method ( M2.method ) { 
    93                 //      it_assert_debug ( n>0,"MixEF::MixEF : Empty Component list" ); 
    94  
    9591                for ( int i = 0; i < n; i++ ) { 
    9692                        Coms ( i ) = M2.Coms ( i )->_copy_(); 
     
    9894                build_est(); 
    9995        } 
     96 
    10097        //! Initializing the mixture by a random pick of centroids from data 
    10198        //! \param Com0 Initial component - necessary to determine its type. 
  • library/bdm/estim/particles.h

    r536 r565  
    177177 
    178178                vec sample() const { 
    179                         it_error ( "Not implemented" ); 
    180                         return 0; 
     179                        bdm_error ( "Not implemented" ); 
     180                        return vec(); 
    181181                } 
    182182 
    183183                double evallog ( const vec &val ) const { 
    184                         it_error ( "not implemented" ); 
     184                        bdm_error ( "not implemented" ); 
    185185                        return 0.0; 
    186186                }