Changeset 681

Show
Ignore:
Timestamp:
10/26/09 15:07:12 (15 years ago)
Author:
smidl
Message:

corrections of Kalman

Location:
library
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/estim/kalman.h

    r679 r681  
    181181                        K->set_parameters (A, B, C, D, Q, R); 
    182182                        K->set_statistics (est._mu(), est._R()); 
     183                        K->validate(); 
    183184                        return K; 
    184185                } 
     
    340341                void from_setting (const Setting &set); 
    341342 
     343                void validate(){}; 
    342344                // TODO dodelat void to_setting( Setting &set ) const; 
    343345 
  • library/tests/testKF_big.m

    r386 r681  
    6868exec_matlab = toc 
    6969 
    70 !cd ../;./tests/testKF 
     70%!./test_kalman 
    7171itload('testKF_res.it'); 
    7272 
     
    8686exec_times 
    8787exec_matlab./exec_times 
    88 keyboard 
     88%keyboard 
    8989end 
  • library/tests/test_kalman.cpp

    r583 r681  
    4242        mu0 = Mu0.get_col ( 0 ); 
    4343 
    44         Ndat = 10;//Dt.cols(); 
     44        Ndat = Dt.cols(); 
    4545        int dimx = A.rows(); 
    4646 
     
    6060        //Chol 
    6161        KalmanCh KF; 
    62         KF.set_parameters ( A, B, C, D, chmat ( R ), chmat ( Q ) ); 
     62        KF.set_parameters ( A, B, C, D, chmat ( Q ), chmat ( R ) ); 
    6363        KF.set_statistics ( mu0, chmat ( P0 ) ); //prediction! 
     64        KF.set_evalll(false); 
     65        KF.validate(); 
    6466        const epdf& KFep = KF.posterior(); 
    6567        mat Xt ( dimx, Ndat ); 
     
    6870        // FULL 
    6971        KalmanFull KF2; 
    70         KF2.set_parameters( A, B, C, D, R, Q); 
     72        KF2.set_parameters( A, B, C, D,  Q, R); 
    7173        KF2.set_statistics(  mu0, P0 ); 
     74        KF2.set_evalll(false); 
     75        KF2.validate(); 
    7276        mat Xt2 ( dimx, Ndat ); 
    7377        Xt2.set_col ( 0, mu0 ); 
     
    8084        KFE.set_parameters ( fxu, hxu, Q, R ); 
    8185        KFE.set_statistics ( mu0, chmat ( P0 ) ); 
     86        KFE.set_evalll(false); 
     87        KFE.validate(); 
    8288        const epdf& KFEep = KFE.posterior(); 
    8389        mat XtE ( dimx, Ndat ); 
     
    8894        vec exec_times ( 3 ); // KF, KF2, KFE 
    8995 
     96        vec dt; 
    9097        tt.tic(); 
    9198        for ( int t = 1; t < Ndat; t++ ) { 
    92                 KF.bayes ( Dt.get_col ( t ) ); 
     99                dt = Dt.get_col(t); 
     100                KF.bayes ( dt.get(0,C.rows()-1), dt.get(C.rows(), dt.length()-1) ); 
    93101                Xt.set_col ( t, KFep.mean() ); 
    94102        } 
     
    97105        tt.tic(); 
    98106        for ( int t = 1; t < Ndat; t++ ) { 
    99                 KF2.bayes ( Dt.get_col ( t ) ); 
     107                dt = Dt.get_col(t); 
     108                KF2.bayes ( dt.get(0,C.rows()-1), dt.get(C.rows(), dt.length()-1) ); 
    100109                Xt2.set_col ( t, KF2.posterior().mean() ); 
    101110        } 
     
    104113        tt.tic(); 
    105114        for ( int t = 1; t < Ndat; t++ ) { 
    106                 KFE.bayes ( Dt.get_col ( t ) ); 
     115                dt = Dt.get_col(t); 
     116                KFE.bayes ( dt.get(0,C.rows()-1), dt.get(C.rows(), dt.length()-1) ); 
    107117                XtE.set_col ( t, KFEep.mean() ); 
    108118        }