Changeset 1168 for library

Show
Ignore:
Timestamp:
08/27/10 17:05:55 (14 years ago)
Author:
smidl
Message:

pmsm stuff fro bierman

Location:
library/bdm/estim
Files:
2 modified

Legend:

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

    r1158 r1168  
    513513                } 
    514514        } 
     515         
     516        if ( log_level[logU] ){ 
     517                // transformed U 
     518                mat tU; 
     519                mat P= U*diag(D)*U.T(); 
     520                 
     521                vec xref(5); 
     522                xref(0)= 30.0*1.4142; 
     523                xref(1)= 30.0*1.4142; 
     524                xref(2)= 6.283185*200.; 
     525                xref(3) = 3.141593; 
     526                xref(4) = 34.0; 
     527                 
     528                mat T = diag(1.0/(xref)); 
     529                mat Pf = T*P*T; 
     530                 
     531                ldmat Pld(Pf); 
     532                 
     533                //vec tmp=vec(U._data(),dimension()*dimension()); 
     534                vec tmp=vec(Pld._L()._data(),dimension()*dimension()); 
     535                log_level.store(logU,round(((int)1<<14)*tmp)); 
     536        } 
     537        if ( log_level[logG] ){ 
     538                vec tmp=vec(G._data(),dimension()*dimension()); 
     539                log_level.store(logG,tmp); 
     540        } 
     541        { 
     542        } 
    515543        //cout << "Ut: " << U << endl; 
    516544        //cout << "Dt: " << D << endl; 
     
    535563                        D(j) = beta*gamma*D(j);  
    536564 
    537                         cout << "a: " << alpha << "g: " << gamma << endl; 
     565//                      cout << "a: " << alpha << "g: " << gamma << endl; 
    538566                        for (i=0;i<j;i++){ 
    539567                                beta   = U(i,j);  
     
    584612        UI::get ( dR, set, "dR", UI::compulsory ); 
    585613        set_parameters ( IM, OM, diag ( dQ ), dR  ); 
    586 } 
    587  
    588 } 
     614         
     615        UI::get(log_level, set, "log_level", UI::optional); 
     616} 
     617 
     618} 
  • library/bdm/estim/kalman.h

    r1158 r1168  
    429429class EKF_UD : public BM { 
    430430        protected: 
     431                //! logger 
     432                LOG_LEVEL(EKF_UD,logU, logG); 
    431433                //! Internal Model f(x,u) 
    432434                shared_ptr<diffbifn> pfxu; 
     
    447449                enorm<ldmat> est; 
    448450        public: 
     451                 
    449452                //! copy constructor duplicated  
    450453                EKF_UD* _copy() const { 
     
    458461                } 
    459462                 
    460  
    461463                EKF_UD(){} 
     464                 
    462465                 
    463466                EKF_UD(const EKF_UD &E0): pfxu(E0.pfxu),phxu(E0.phxu), U(E0.U), D(E0.D){} 
     
    469472                void bayes ( const vec &yt, const vec &cond = empty_vec ); 
    470473                 
     474                void log_register ( bdm::logger& L, const string& prefix ){ 
     475                        BM::log_register ( L, prefix ); 
     476                                                 
     477                        if ( log_level[logU] ) 
     478                                L.add_vector ( log_level, logU, RV ( dimension()*dimension() ), prefix ); 
     479                        if ( log_level[logG] ) 
     480                                L.add_vector ( log_level, logG, RV ( dimension()*dimension() ), prefix ); 
     481                         
     482                } 
    471483                /*! Create object from the following structure 
    472484