Changeset 270 for bdm/stat/libFN.h

Show
Ignore:
Timestamp:
02/16/09 10:02:08 (15 years ago)
Author:
smidl
Message:

Changes in the very root classes!
* rv and rvc are no longer compulsory,
* samplecond does not return ll
* BM has drv

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/libFN.h

    r262 r270  
    2828                vec eval ( const vec &cond ) {return val;}; 
    2929                //!Default constructor 
    30                 constfn ( const vec &val0 ) :fnc(val0.length()), val ( val0 ) {}; 
     30                constfn ( const vec &val0 ) :fnc(), val ( val0 ) {dimy=val.length();}; 
    3131}; 
    3232 
     
    3838                //! Matrix A 
    3939                mat A; 
    40                 //! Matrix B 
     40                //! vector B 
    4141                vec B; 
    4242        public : 
    43                 vec eval (const vec &cond ) {it_assert_debug ( cond.length() ==rv.count(), "linfn::eval Wrong cond." );return A*cond+B;}; 
     43                vec eval (const vec &cond ) {it_assert_debug ( cond.length() ==A.cols(), "linfn::eval Wrong cond." );return A*cond+B;}; 
    4444 
    4545//              linfn evalsome ( ivec &rvind ); 
    4646                //!default constructor 
    47                 linfn ( const RV &rv0 ) : fnc(rv0.count()), rv ( rv0 ),A ( eye ( rv0.count() ) ),B ( zeros ( rv0.count() ) ) { }; 
     47                linfn ( ) : fnc(), A ( ),B () { }; 
    4848                //! Set values of \c A and \c B 
    49                 void set_parameters ( const mat &A0 , const vec &B0 ) {A=A0; B=B0;}; 
     49                void set_parameters ( const mat &A0 , const vec &B0 ) {A=A0; B=B0; dimy=A.rows();}; 
    5050}; 
    5151 
     
    8686                virtual void dfdu_cond ( const vec &x0, const vec &u0, mat &A, bool full=true ) {}; 
    8787                //!Default constructor (dimy is not set!) 
    88                 diffbifn (int dimy, const RV rvx0, const RV rvu0 ) : fnc(dimy), rvx ( rvx0 ),rvu ( rvu0 ) {dimx=rvx.count();dimu=rvu.count();}; 
     88                diffbifn () : fnc() {}; 
    8989                //! access function 
    9090                int _dimx() const{return dimx;} 
     
    100100                mat B; 
    101101        public : 
     102                //!\name Constructors 
     103                //!@{ 
     104                 
     105                bilinfn () : diffbifn () ,A() ,B()      {}; 
     106                bilinfn (const mat A0, const mat B0) {set_parameters(A0,B0);}; 
     107                //! Alternative constructor 
     108                void set_parameters(const mat A0, const mat B0){ 
     109                        it_assert_debug(A0.rows()==B0.rows(),""); 
     110                        A=A0;B=B0; 
     111                        dimy=A.rows(); 
     112                        dimx=A.cols(); 
     113                        dimu=B.cols(); 
     114                } 
     115                //!@} 
     116                 
     117                //!\name Mathematical operations 
     118                //!@{ 
    102119                vec eval ( const  vec &x0, const vec &u0 ); 
    103  
    104                 //! Default constructor 
    105                 bilinfn ( const RV &rvx0, const RV &rvu0 ) : diffbifn (dimx, rvx0,rvu0 ) ,A ( eye ( dimx ) ),B ( zeros ( dimx,dimu ) )  {}; 
    106                 //! Alternative constructor 
    107                 bilinfn ( const RV &rvx0, const RV &rvu0, const mat &A0, const mat &B0 ); 
    108                 //! 
    109120                void dfdx_cond ( const vec &x0, const vec &u0, mat &F, bool full ) 
    110121                { 
     
    118129                        if ( full ) F=B;        //else : nothing has changed no need to regenerate 
    119130                } 
     131                //!@} 
    120132}; 
    121133