Show
Ignore:
Timestamp:
11/15/09 23:02:02 (15 years ago)
Author:
smidl
Message:

Big commit of LQG stuff

Files:
1 modified

Legend:

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

    r700 r723  
    9898        } 
    9999        //! conditional version of the predictor 
    100         mlnorm<ldmat>* predictor() const; 
     100        template<class sq_T> 
     101        shared_ptr<mlnorm<sq_T> > ml_predictor() const; 
     102        //! fast version of predicto  
     103        template<class sq_T> 
     104        void ml_predictor_update(mlnorm<sq_T> &pred) const; 
    101105        mlstudent* predictor_student() const; 
    102106        //! Brute force structure estimation.\return indeces of accepted regressors. 
     
    188192}; 
    189193UIREGISTER(ARXfrg); 
     194 
     195 
     196//////////////////// 
     197template<class sq_T> 
     198shared_ptr< mlnorm<sq_T> > ARX::ml_predictor ( ) const { 
     199        shared_ptr< mlnorm<sq_T> > tmp = new mlnorm<sq_T> ( ); 
     200        tmp->set_rv(yrv); 
     201        tmp->set_rvc(_rvc()); 
     202         
     203        ml_predictor_update(*tmp); 
     204        tmp->validate(); 
     205        return tmp; 
     206} 
     207 
     208template<class sq_T> 
     209void ARX::ml_predictor_update(mlnorm<sq_T> &pred) const { 
     210        mat mu ( dimy, posterior()._V().rows() - dimy ); 
     211        mat R ( dimy, dimy ); 
     212         
     213        est.mean_mat ( mu, R ); //mu = 
     214        mu = mu.T(); 
     215        //correction for student-t  -- TODO check if correct!! 
     216         
     217        if ( have_constant) { // constant term 
     218                //Assume the constant term is the last one: 
     219                pred.set_parameters ( mu.get_cols ( 0, mu.cols() - 2 ), mu.get_col ( mu.cols() - 1 ), sq_T ( R ) ); 
     220        } else { 
     221                pred.set_parameters ( mu, zeros ( dimy ), sq_T( R ) ); 
     222        } 
     223} 
     224 
    190225}; 
    191226#endif // AR_H