Changeset 1130 for library/bdm/math

Show
Ignore:
Timestamp:
07/09/10 12:39:41 (14 years ago)
Author:
smidl
Message:

Basic outline of universal LQG controller

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/math/functions.h

    r1064 r1130  
    3838//! Class representing function \f$f(x) = Ax+B\f$ 
    3939class linfn: public fnc { 
     40  public: 
    4041    //! Identification of \f$x\f$ 
    4142    RV rv; 
     
    5354    //!default constructor 
    5455    linfn ( ) : fnc(), A ( ), B () { }; 
     56    linfn ( const mat &A0, const vec &B0 ) : fnc(), A (A0 ), B (B0) { }; 
    5557    //! Set values of \c A and \c B 
    5658    void set_parameters ( const mat &A0 , const vec &B0 ) { 
     
    7072UIREGISTER(linfn); 
    7173 
     74 
     75//! Class representing function \f$ f(x) = [x' 1] Q [x' 1]' \f$ with Q in choleski decomposition 
     76class quadraticfn: public fnc { 
     77public : 
     78    //! Identification of \f$x\f$ 
     79    RV rv; 
     80    //! Matrix Q 
     81    chmat Q; 
     82 
     83     
     84    vec eval ( const vec &cond ) { 
     85        bdm_assert_debug ( cond.length() == Q.cols(), "quadraticfc::eval Wrong cond." ); 
     86        return vec_1( Q.qform(concat(cond,1.0)) ); 
     87    } 
     88 
     89    void from_setting(const Setting &set) { 
     90//        UI::get(Q,set,"Q",UI::compulsory); 
     91    } 
     92    void validate() { 
     93        dimy = 1; 
     94        dimc = Q.cols()-1; 
     95    } 
     96 
     97}; 
     98UIREGISTER(quadraticfn); 
    7299 
    73100/*!