Changeset 211

Show
Ignore:
Timestamp:
11/13/08 20:00:53 (15 years ago)
Author:
smidl
Message:

prejmenovani evalpdflog a evalcond

Files:
26 modified
1 copied

Legend:

Unmodified
Added
Removed
  • CMakeLists.txt

    r208 r211  
    2727        #This is for UNIX makefile which does only one release at a time. 
    2828        SET(CMAKE_BUILD_TYPE Debug) 
    29         SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wno-unknown-pragmas") 
     29        SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -DNDEBUG -O3 -pipe -Wno-unknown-pragmas") 
    3030        INCLUDE(CMakeLocal.txt OPTIONAL)         
    3131ENDIF(WIN32) 
  • CMake_modules/FindITPP.cmake

    r209 r211  
    1111 
    1212FIND_PATH(ITPP_INCLUDE_DIR itpp/itbase.h 
    13         ${ITPP_DIR} 
     13        ${ITPP_DIR}/include 
    1414        /usr/pkgs64/include 
    1515  ) 
     
    1717FIND_LIBRARY(ITPP_LIBRARY 
    1818  NAMES itpp itpp_debug 
    19   PATHS $ITPP_DIR  
    20   /home/smidl/work/git/trunk/itpp/.libs 
     19  PATHS ${ITPP_DIR}/libs  
    2120  "${ITPP_DIR}\\win32\\lib" 
    2221  /usr/pkgs64/lib 
  • bdm/estim/libKF.cpp

    r141 r211  
    158158         
    159159        if ( evalll==true ) { //likelihood of observation y 
    160                 ll=fy.evalpdflog ( y ); 
     160                ll=fy.evallog ( y ); 
    161161        } 
    162162} 
     
    232232 
    233233        if ( evalll==true ) { //likelihood of observation y 
    234                 ll=fy.evalpdflog ( y ); 
     234                ll=fy.evallog ( y ); 
    235235        } 
    236236} 
  • bdm/estim/libKF.h

    r200 r211  
    332332 
    333333        if ( evalll==true ) { //likelihood of observation y 
    334                 ll=fy.evalpdflog ( y ); 
     334                ll=fy.evallog ( y ); 
    335335        } 
    336336 
     
    395395        ( _mu ) += _K* ( y-_yp ); 
    396396 
    397         if ( evalll==true ) {ll+=fy.evalpdflog ( y );} 
     397        if ( evalll==true ) {ll+=fy.evallog ( y );} 
    398398}; 
    399399 
  • bdm/estim/libPF.cpp

    r60 r211  
    1414                //generate new samples from paramater evolution model; 
    1515                _samples ( i ) = par.samplecond ( _samples ( i ), lls ( i ) ); 
    16                 lls ( i ) *= obs.evalcond ( dt,_samples ( i ) ); 
     16                lls ( i ) *= obs.evallogcond ( dt,_samples ( i ) ); 
    1717 
    1818                if ( lls ( i ) >mlls ) mlls=lls ( i ); //find maximum 
  • bdm/estim/libPF.h

    r200 r211  
    9494                vec sample() const {it_error ( "Not implemented" );return 0;} 
    9595 
    96                 double evalpdflog ( const vec &val ) const {it_error ( "not implemented" ); return 0.0;} 
     96                double evallog ( const vec &val ) const {it_error ( "not implemented" ); return 0.0;} 
    9797        }; 
    9898 
  • bdm/estim/merger.cpp

    r205 r211  
    102102                                // no need for conditioning or marginalization 
    103103                                for ( int j=0;j<Ns; j++ ) { // Smp is Array<> => for cycle 
    104                                         lw_src ( j ) =mpdfs ( i )->_epdf().evalpdflog ( Smp ( j ) ); 
     104                                        lw_src ( j ) =mpdfs ( i )->_epdf().evallog ( Smp ( j ) ); 
    105105                                } 
    106106                        } 
     
    113113                                        for ( int k=0;k<Ns;k++ ) { 
    114114                                                // Here val of tmp_marg = cond of mpdfs(i) ==> calling dls->get_cond 
    115                                                 lw_src ( k ) += tmp_marg->evalpdflog ( dls ( i )->get_cond ( Smp ( k ) ) ); 
     115                                                lw_src ( k ) += tmp_marg->evallog ( dls ( i )->get_cond ( Smp ( k ) ) ); 
    116116                                        } 
    117117                                        delete tmp_marg; 
     
    130130                                        for ( int k= 0; k<Ns; k++ ) { 
    131131                                                lw_src ( k ) += log ( 
    132                                                                     tmp_cond->evalcond ( 
     132                                                                    tmp_cond->evallogcond ( 
    133133                                                                        zdls ( i )->get_val ( Smp ( k ) ), 
    134134                                                                        zdls ( i )->get_cond ( Smp ( k ) ) ) ); 
     
    142142                                for ( int k= 0; k<Ns; k++ ) { 
    143143                                        mpdfs ( i )->condition ( dls ( i )->get_cond ( Smp ( k ) ) ); 
    144                                         lw_src ( k ) += mpdfs ( i )->_epdf().evalpdflog ( dls ( i )->get_val ( Smp ( k ) ) ); 
     144                                        lw_src ( k ) += mpdfs ( i )->_epdf().evallog ( dls ( i )->get_val ( Smp ( k ) ) ); 
    145145                                } 
    146146 
  • bdm/estim/merger.h

    r205 r211  
    8888//! weight w is a 
    8989        vec sample ( ) const { return Mix._epdf().sample();} 
    90         double evalpdflog ( const vec &dt ) const { 
     90        double evallog ( const vec &dt ) const { 
    9191                vec dtf=ones ( dt.length() +1 ); 
    9292                dtf.set_subvector ( 0,dt ); 
  • bdm/stat/emix.h

    r204 r211  
    3232In particular this type of arise by conditioning of a mixture model. 
    3333 
    34 At present the only supported operation is evalcond(). 
     34At present the only supported operation is evallogcond(). 
    3535 */ 
    3636class mratio: public mpdf { 
     
    6060                den = nom->marginal ( rvc ); 
    6161        }; 
    62         double evalcond ( const vec &val, const vec &cond ) { 
     62        double evallogcond ( const vec &val, const vec &cond ) { 
    6363                vec nom_val ( rv.count() +rvc.count() ); 
    6464                dl.fill_val_cond ( nom_val,val,cond ); 
    65                 return exp ( nom->evalpdflog ( nom_val ) - den->evalpdflog ( cond ) ); 
     65                return exp ( nom->evallog ( nom_val ) - den->evallog ( cond ) ); 
    6666        } 
    6767        //! Object takes ownership of nom and will destroy it 
     
    102102                return mu; 
    103103        } 
    104         double evalpdflog ( const vec &val ) const { 
     104        double evallog ( const vec &val ) const { 
    105105                int i; 
    106106                double sum = 0.0; 
    107                 for ( i = 0;i < w.length();i++ ) {sum += w ( i ) * exp ( Coms ( i )->evalpdflog ( val ) );} 
     107                for ( i = 0;i < w.length();i++ ) {sum += w ( i ) * exp ( Coms ( i )->evallog ( val ) );} 
    108108                return log ( sum ); 
    109109        }; 
    110         vec evalpdflog_m ( const mat &Val ) const { 
     110        vec evallog_m ( const mat &Val ) const { 
    111111                vec x=zeros ( Val.cols() ); 
    112112                for ( int i = 0; i < w.length(); i++ ) { 
    113                         x+= w ( i ) *exp ( Coms ( i )->evalpdflog_m ( Val ) ); 
     113                        x+= w ( i ) *exp ( Coms ( i )->evallog_m ( Val ) ); 
    114114                } 
    115115                return log ( x ); 
    116116        }; 
    117         mat evalpdflog_M ( const mat &Val ) const { 
     117        mat evallog_M ( const mat &Val ) const { 
    118118                mat X ( w.length(), Val.cols() ); 
    119119                for ( int i = 0; i < w.length(); i++ ) { 
    120                         X.set_row ( i, w ( i ) *exp ( Coms ( i )->evalpdflog_m ( Val ) ) ); 
     120                        X.set_row ( i, w ( i ) *exp ( Coms ( i )->evallog_m ( Val ) ) ); 
    121121                } 
    122122                return X; 
     
    166166        }; 
    167167 
    168         double evalcond ( const vec &val, const vec &cond ) { 
     168        double evallogcond ( const vec &val, const vec &cond ) { 
    169169                int i; 
    170170                double res = 1.0; 
     
    174174                                                } 
    175175                                                // add logarithms 
    176                                                 res += epdfs ( i )->evalpdflog ( dls ( i )->get_val ( val ) );*/ 
    177                         res *= mpdfs ( i )->evalcond ( 
     176                                                res += epdfs ( i )->evallog ( dls ( i )->get_val ( val ) );*/ 
     177                        res *= mpdfs ( i )->evallogcond ( 
    178178                                   dls ( i )->get_val ( val ), 
    179179                                   dls ( i )->get_cond ( val, cond ) 
     
    196196                        dls ( i )->fill_val ( smp, smpi ); 
    197197                        // add ith likelihood contribution 
    198                         ll+=epdfs ( i )->evalpdflog ( smpi ); 
     198                        ll+=epdfs ( i )->evallog ( smpi ); 
    199199                } 
    200200                return smp; 
     
    244244                return tmp; 
    245245        } 
    246         double evalpdflog ( const vec &val ) const { 
     246        double evallog ( const vec &val ) const { 
    247247                double tmp=0; 
    248248                for ( int i=0;i<epdfs.length();i++ ) { 
    249                         tmp+=epdfs ( i )->evalpdflog ( dls ( i )->get_val ( val ) ); 
     249                        tmp+=epdfs ( i )->evallog ( dls ( i )->get_val ( val ) ); 
    250250                } 
    251251                return tmp; 
  • bdm/stat/libBM.cpp

    r201 r211  
    88 
    99static int RVcounter=0; 
     10 
     11RV RV0=RV(); 
    1012 
    1113void RV::init ( ivec in_ids, Array<std::string> in_names, ivec in_sizes, ivec in_times ) { 
  • bdm/stat/libBM.h

    r203 r211  
    126126RV concat ( const RV &rv1, const RV &rv2 ); 
    127127 
     128//!Default empty RV that can be used as default argument 
     129extern RV RV0; 
    128130 
    129131//! Class representing function \f$f(x)\f$ of variable \f$x\f$ represented by \c rv 
     
    172174         
    173175        //! Compute log-probability of argument \c val 
    174         virtual double evalpdflog ( const vec &val ) const =0; 
     176        virtual double evallog ( const vec &val ) const =0; 
    175177 
    176178        //! Compute log-probability of multiple values argument \c val 
    177         virtual vec evalpdflog_m ( const mat &Val ) const { 
     179        virtual vec evallog_m ( const mat &Val ) const { 
    178180                vec x ( Val.cols() ); 
    179                 for ( int i=0;i<Val.cols();i++ ) {x ( i ) =evalpdflog ( Val.get_col ( i ) ) ;} 
     181                for ( int i=0;i<Val.cols();i++ ) {x ( i ) =evallog ( Val.get_col ( i ) ) ;} 
    180182                return x; 
    181183        } 
     
    217219                this->condition ( cond ); 
    218220                vec temp= ep->sample(); 
    219                 ll=ep->evalpdflog ( temp );return temp; 
     221                ll=ep->evallog ( temp );return temp; 
    220222        }; 
    221223        //! Returns \param N samples from the density conditioned on \c cond, \f$x \sim epdf(rv|cond)\f$. \param cond is numeric value of \c rv \param ll is a return value of log-likelihood of the sample. 
    222         virtual mat samplecond ( const vec &cond, vec &ll, int N ) { 
     224        virtual mat samplecond_m ( const vec &cond, vec &ll, int N ) { 
    223225                this->condition ( cond ); 
    224226                mat temp ( rv.count(),N ); vec smp ( rv.count() ); 
    225                 for ( int i=0;i<N;i++ ) {smp=ep->sample() ;temp.set_col ( i, smp );ll ( i ) =ep->evalpdflog ( smp );} 
     227                for ( int i=0;i<N;i++ ) {smp=ep->sample() ;temp.set_col ( i, smp );ll ( i ) =ep->evallog ( smp );} 
    226228                return temp; 
    227229        }; 
     
    230232 
    231233        //! Shortcut for conditioning and evaluation of the internal epdf. In some cases,  this operation can be implemented efficiently. 
    232         virtual double evalcond ( const vec &dt, const vec &cond ) {this->condition ( cond );return exp(ep->evalpdflog ( dt ));}; 
    233  
    234         virtual vec evalcond_m ( const mat &Dt, const vec &cond ) {this->condition ( cond );return exp(ep->evalpdflog_m ( Dt ));}; 
     234        virtual double evallogcond ( const vec &dt, const vec &cond ) {this->condition ( cond );return ep->evallog ( dt );}; 
     235 
     236        //! Matrix version of evallogcond 
     237        virtual vec evallogcond_m ( const mat &Dt, const vec &cond ) {this->condition ( cond );return ep->evallog_m ( Dt );}; 
    235238 
    236239        //! Destructor for future use; 
  • bdm/stat/libEF.cpp

    r198 r211  
    1919} 
    2020 
    21 double egiw::evalpdflog_nn ( const vec &val ) const { 
     21double egiw::evallog_nn ( const vec &val ) const { 
    2222        int vend = val.length()-1; 
    2323 
     
    128128// } 
    129129 
    130 double egamma::evalpdflog ( const vec &val ) const { 
     130double egamma::evallog ( const vec &val ) const { 
    131131        double res = 0.0; //the rest will be added 
    132132        int i; 
  • bdm/stat/libEF.h

    r205 r211  
    4646        virtual void dupdate ( mat &v ) {it_error ( "Not implemented" );}; 
    4747        //!Evaluate normalized log-probability 
    48         virtual double evalpdflog_nn ( const vec &val ) const{it_error ( "Not implemented" );return 0.0;}; 
     48        virtual double evallog_nn ( const vec &val ) const{it_error ( "Not implemented" );return 0.0;}; 
    4949        //!Evaluate normalized log-probability 
    50         virtual double evalpdflog ( const vec &val ) const {double tmp;tmp= evalpdflog_nn ( val )-lognc();it_assert_debug(std::isfinite(tmp),"why?"); return tmp;} 
     50        virtual double evallog ( const vec &val ) const {double tmp;tmp= evallog_nn ( val )-lognc();it_assert_debug(std::isfinite(tmp),"why?"); return tmp;} 
    5151        //!Evaluate normalized log-probability for many samples 
    52         virtual vec evalpdflog ( const mat &Val ) const { 
     52        virtual vec evallog ( const mat &Val ) const { 
    5353                vec x ( Val.cols() ); 
    54                 for ( int i=0;i<Val.cols();i++ ) {x ( i ) =evalpdflog_nn ( Val.get_col ( i ) ) ;} 
     54                for ( int i=0;i<Val.cols();i++ ) {x ( i ) =evallog_nn ( Val.get_col ( i ) ) ;} 
    5555                return x-lognc(); 
    5656        } 
     
    129129        mat sample ( int N ) const; 
    130130        double eval ( const vec &val ) const ; 
    131         double evalpdflog_nn ( const vec &val ) const; 
     131        double evallog_nn ( const vec &val ) const; 
    132132        double lognc () const; 
    133133        vec mean() const {return mu;} 
     
    193193        void mean_mat ( mat &M, mat&R ) const; 
    194194        //! In this instance, val= [theta, r]. For multivariate instances, it is stored columnwise val = [theta_1 theta_2 ... r_1 r_2 ] 
    195         double evalpdflog_nn ( const vec &val ) const; 
     195        double evallog_nn ( const vec &val ) const; 
    196196        double lognc () const; 
    197197 
     
    227227        vec mean() const {return beta/sum ( beta );}; 
    228228        //! In this instance, val is ... 
    229         double evalpdflog_nn ( const vec &val ) const {return ( beta-1 ) *log ( val );}; 
     229        double evallog_nn ( const vec &val ) const {return ( beta-1 ) *log ( val );}; 
    230230        double lognc () const { 
    231231                double gam=sum ( beta ); 
     
    318318        //! TODO: is it used anywhere? 
    319319//      mat sample ( int N ) const; 
    320         double evalpdflog ( const vec &val ) const; 
     320        double evallog ( const vec &val ) const; 
    321321        double lognc () const; 
    322322        //! Returns poiter to alpha and beta. Potentially dengerous: use with care! 
     
    358358        euni ( const RV rv ) :epdf ( rv ) {} 
    359359        double eval ( const vec &val ) const  {return nk;} 
    360         double evalpdflog ( const vec &val ) const  {return lnk;} 
     360        double evallog ( const vec &val ) const  {return lnk;} 
    361361        vec sample() const { 
    362362                vec smp ( rv.count() ); 
     
    538538        vec sample() const {it_error ( "Not implemented" );return 0;} 
    539539        //! inherited operation : NOT implemneted 
    540         double evalpdflog ( const vec &val ) const {it_error ( "Not implemented" );return 0.0;} 
     540        double evallog ( const vec &val ) const {it_error ( "Not implemented" );return 0.0;} 
    541541        vec mean() const { 
    542542                vec pom=zeros ( rv.count() ); 
     
    599599double enorm<sq_T>::eval ( const vec &val ) const { 
    600600        double pdfl,e; 
    601         pdfl = evalpdflog ( val ); 
     601        pdfl = evallog ( val ); 
    602602        e = exp ( pdfl ); 
    603603        return e; 
     
    605605 
    606606template<class sq_T> 
    607 double enorm<sq_T>::evalpdflog_nn ( const vec &val ) const { 
     607double enorm<sq_T>::evallog_nn ( const vec &val ) const { 
    608608        // 1.83787706640935 = log(2pi) 
    609609        double tmp=-0.5* ( R.invqform ( mu-val ) );// - lognc(); 
  • mpdm/merg_2a.cpp

    r205 r211  
    1313        // Setup model 
    1414        RV y ( "{y }" ); 
    15         RV u1 ( "{u1 }" ); 
    16         RV u2 ( "{u2 }" ); 
    17         RV uu=u1; uu.add ( u2 ); 
    18  
    19         double a1t = 1.5; 
    20         double a2t = 0.8; 
    21         double sqr=0.10; 
     15        RV u ( "{u }" ); 
     16        RV um = u; um.t(-1); 
     17        RV z ( "{z }" ); 
     18        RV a ("{a }"); 
     19        RV b ("{b }"); 
     20        RV c ("{c }"); 
     21        RV r ("{r }"); 
     22         
     23        double at = 1.5; 
     24        double bt = 0.8; 
     25        double ct = 0.50; 
     26        double sig = 0.10; 
    2227        // Full system 
    23         vec thg =vec_2 ( a1t,a2t ); //Simulated system - zero for constant term 
    24         vec Th = concat ( thg, sqr ); //Full parameter 
    25  
    26         // Estimated systems ARX(2) 
    27         RV a1 ( "{a1 }" ); 
    28         RV a2 ( "{a2 }" ); 
    29         RV r ( "{r }" ); 
    30         RV all =a1; all.add ( a2 ); all.add ( r ); 
    31         RV allj =a1; allj.add ( r ); allj.add ( a2 ); 
    32         vec Thj=vec_3 ( a1t,sqr,a2t ); 
    33         // Setup values 
     28        vec thy =vec_2 ( at,bt ); //Simulated system - zero for constant term 
     29        vec thu =vec_2 ( at,ct ); //Simulated system - zero for constant term 
     30        vec Thy = concat ( thy, vec_1(sig) ); //Full parameter 
     31        vec Thu = concat ( thu, vec_1(sig) ); //Full parameter 
    3432 
    3533        //ARX constructor 
    36         mat V0 = 0.001*eye ( 2 ); V0 ( 0,0 ) = 1; // 
    37         mat V0g = 0.001*eye ( 3 ); V0g ( 0,0 ) = 1; // 
     34        mat V0 = 0.001*eye ( 3 ); V0 ( 0,0 ) = 1; // 
    3835 
    39         ARX P1 ( concat ( a1,r ), V0, -1 ); 
    40         ARX P2 ( concat ( a2,r ), V0, -1 ); 
    41         ARX PG ( all, V0g, -1 ); //or -1? 
    42 //      ARX PGk ( all, V0g, -1 ); 
     36        ARX P1 ( concat ( a, concat(b,r) ), V0, -1 ); 
     37        ARX P2 ( concat ( a, concat(c,r) ), V0, -1 ); 
    4338 
    4439        //Test estimation 
     
    4742 
    4843        // Logging 
    49         dirfilelog L ( "exp/merg_giw",ndat ); 
     44        dirfilelog L ( "exp/merg_2a",ndat ); 
    5045        int Li_Data = L.add ( RV ( "{Y U1 U2 }" ), "" ); 
    5146        int Li_LL   = L.add ( RV ( "{G M }" ), "LL" ); 
    52         int Li_P1m   = L.add ( RV ( "{a1 r }" ), "P1" ); 
    53         int Li_P2m   = L.add ( RV ( "{a2 r }" ), "P2" ); 
    54         int Li_Gm   = L.add ( RV ( "{a1 a2 r }" ), "G" ); 
    55         int Li_Mm   = L.add ( RV ( "{a1 r a2 }" ), "M" ); 
     47        int Li_P1m   = L.add ( RV ( "{a b r }" ), "P1" ); 
     48        int Li_P2m   = L.add ( RV ( "{a c r }" ), "P2" ); 
    5649        L.init(); 
    5750 
    5851        vec Yt ( ndat ); 
    5952        vec yt ( 1 ); 
    60  
    61         vec LLs ( 2 ); 
    62         vec rgrg ( 2 ); 
    6353 
    6454        //Proposal 
     
    9686                Array<mpdf*> A ( 2 ); A ( 0 ) =&eG1;A ( 1 ) =&eG2; 
    9787                merger M ( A ); 
    98                 M.set_parameters ( 1.5, 100,3 ); //M._Mix().set_method(QB); 
     88                M.set_parameters ( 10, 100,3 ); //M._Mix().set_method(QB); 
    9989                //M2.set_parameters ( 100.0, 1000,3 ); //M2._Mix().set_method(QB); 
    10090                M.merge ( &G0 ); 
  • mpdm/merg_giw.cpp

    r205 r211  
    104104                yt ( 0 ) = Yt ( t ); 
    105105 
    106 //              LLs ( 0 ) = P1._e()->evalpdflog ( get_vec(Th, "1 2") ); 
    107 //              LLs ( 1 ) = P2._e()->evalpdflog ( get_vec(Th, "3 2")  ); 
    108                 LLs ( 0 ) = PG._e()->evalpdflog ( Th ); 
     106//              LLs ( 0 ) = P1._e()->evallog ( get_vec(Th, "1 2") ); 
     107//              LLs ( 1 ) = P2._e()->evallog ( get_vec(Th, "3 2")  ); 
     108                LLs ( 0 ) = PG._e()->evallog ( Th ); 
    109109                LLs ( 1 ) = M._Mix().logpred ( concat ( Thj, vec_1 ( 1.0 ) ) ); 
    110110//              LLs ( 3 ) = M2._Mix().logpred ( concat(Thj, vec_1(1.0)) ); 
  • mpdm/merg_pred.cpp

    r204 r211  
    9494                                 
    9595                                yt(0) = Yt(t); 
    96                                 double P1pl = P1p->evalcond(yt,rgr1);    
    97                                 double P2pl = P2p->evalcond(yt,rgr2);    
    98                                 double PGpl = Pgp->evalcond(yt,rgrg);    
     96                                double P1pl = P1p->evallogcond(yt,rgr1);         
     97                                double P2pl = P2p->evallogcond(yt,rgr2);         
     98                                double PGpl = Pgp->evallogcond(yt,rgrg);         
    9999                                { 
    100100                                        cout << "yt: " << yt << endl; 
     
    113113                                        mlnorm<ldmat>* cP2p = (mlnorm<ldmat>*)mP2p->condition(y); 
    114114 
    115                                         cP1pl = cP1p->evalcond(yt,rgr1);         
    116                                         cP2pl = cP2p->evalcond(yt,rgr2);         
     115                                        cP1pl = cP1p->evallogcond(yt,rgr1);      
     116                                        cP2pl = cP2p->evallogcond(yt,rgr2);      
    117117                                 
    118118                                        cout << "ytm1: " << cP1p->_epdf().mean() << endl; 
  • tests/arx_elem_test.cpp

    r201 r211  
    4040         
    4141        mlstudent* Ap = Ar.predictor_student(RV("{y }"),RV("{1 }")); 
    42         vec Ap_x=Ap->evalcond_m(X,vec_1(1.0)); 
     42        vec Ap_x=Ap->evallogcond_m(X,vec_1(1.0)); 
    4343        vec ll_x = Ar.logpred_m(X2); 
    4444         
  • tests/arx_test.cpp

    r198 r211  
    4141                cout << "y: " << Yt(t) << endl; 
    4242                mlstudent*      Pr = Ar.predictor_student(RV("{y }"),RV("{y1 y2 y3 y4 }")); 
    43                 cout << Ar._ll() <<" , " << log(Pr->evalcond(vec_1(Yt(t)),rgr)) <<endl; 
     43                cout << Ar._ll() <<" , " << log(Pr->evallogcond(vec_1(Yt(t)),rgr)) <<endl; 
    4444                delete Pr; 
    4545        } 
  • tests/blas_test.cpp

    r141 r211  
    66using std::cout; 
    77using std::endl; 
     8 
     9//#define NDEBUG 
    810 
    911mat matmul ( mat &A, mat &B ) { 
  • tests/egiw_test.cpp

    r188 r211  
    4444                                t_val ( 1 ) = Si ( j ); 
    4545 
    46                                 pdf ( i,j ) =E.evalpdflog ( t_val ); 
     46                                pdf ( i,j ) =E.evallog ( t_val ); 
    4747                        } 
    4848                } 
     
    9797                                        t_val ( 2 ) = ( j+1 ) * ( 1.0/n ) *2.0; 
    9898 
    99                                         Tmp ( i,j ) = E.evalpdflog ( t_val ); 
     99                                        Tmp ( i,j ) = E.evallog ( t_val ); 
    100100                                } 
    101101                        } 
  • tests/emix_test.cpp

    r203 r211  
    1919                for ( double y=yb ( 0 );y<=yb ( 1 );y+=ystep,j++ ) { 
    2020                        rgr ( 1 ) =y; 
    21                         PPdf ( i,j ) =exp ( ep->evalpdflog ( rgr ) ); 
     21                        PPdf ( i,j ) =exp ( ep->evallog ( rgr ) ); 
    2222                } 
    2323        } 
     
    5858        cout << *((mlnorm<ldmat>*)Ac) <<endl; 
    5959         
    60         cout << "Mix marg at 0: " << Mm->evalpdflog(vec_1(0.0)) <<endl; 
    61         cout << "ARX marg at 0: " << Am->evalpdflog(vec_1(0.0)) <<endl; 
    62         cout << "Mix cond at 0,0: " << Mc->evalcond(vec_1(0.0),vec_1(0.0)) <<endl; 
    63         cout << "ARX cond at 0,0: " << Ac->evalcond(vec_1(0.0),vec_1(0.0)) <<endl; 
     60        cout << "Mix marg at 0: " << Mm->evallog(vec_1(0.0)) <<endl; 
     61        cout << "ARX marg at 0: " << Am->evallog(vec_1(0.0)) <<endl; 
     62        cout << "Mix cond at 0,0: " << Mc->evallogcond(vec_1(0.0),vec_1(0.0)) <<endl; 
     63        cout << "ARX cond at 0,0: " << Ac->evallogcond(vec_1(0.0),vec_1(0.0)) <<endl; 
    6464         
    6565        cout << "======== Mixture with two components ==="<<endl; 
     
    7878        vec ll2 ( N ); 
    7979        mat Smp=M2.sample_m ( N ); 
    80         ll = M2.evalpdflog_m(Smp); 
     80        ll = M2.evallog_m(Smp); 
    8181         
    8282        vec Emu = sum ( Smp,2 ) /N; 
     
    102102 
    103103        for (int j=0; j<N; j++){ 
    104                 ll2(j)=mEp.evalcond (Smp.get_col(j), vec ( 0 )); 
     104                ll2(j)=mEp.evallogcond (Smp.get_col(j), vec ( 0 )); 
    105105        } 
    106106        it << Name("ll") << ll; 
  • tests/enorm_test.cpp

    r203 r211  
    1919                for ( double y=yb ( 0 );y<=yb ( 1 );y+=ystep,j++ ) { 
    2020                        rgr ( 1 ) =y; 
    21                         PPdf ( i,j ) =exp ( ep->evalpdflog ( rgr ) ); 
     21                        PPdf ( i,j ) =exp ( ep->evallog ( rgr ) ); 
    2222                } 
    2323        } 
     
    7373         
    7474        cout << endl << " test of pdflog at zero "<<endl; 
    75         cout << "original: " << exp(E.evalpdflog(vec("0 0"))) <<endl; 
    76         cout << "composite: " << mEp.evalcond(vec("0 0"),vec(0)) << endl; 
     75        cout << "original: " << exp(E.evallog(vec("0 0"))) <<endl; 
     76        cout << "composite: " << mEp.evallogcond(vec("0 0"),vec(0)) << endl; 
    7777} 
  • tests/merger_2d_test.cpp

    r205 r211  
    5252        emix* MP = MM.predictor(xy); 
    5353         
    54         vec Res1 = M.evalpdflog_m(Grid); 
    55         mat Res2 = (MP)->evalpdflog_M(Grid); 
     54        vec Res1 = M.evallog_m(Grid); 
     55        mat Res2 = (MP)->evallog_M(Grid); 
    5656         
    5757        it_file it("merger_2d_test.it"); 
     
    6060        it << Name("Res1") << Res1; 
    6161        it << Name("Res2") << Res2; 
    62         it << Name("S1") << f1.evalpdflog_m(Grid); 
    63         it << Name("S2") << f2.evalpdflog_m(Grid); 
     62        it << Name("S1") << f1.evallog_m(Grid); 
     63        it << Name("S2") << f2.evallog_m(Grid); 
    6464        cout << ((enorm<ldmat>*)(MP->_Coms(0)))->_R().to_mat() << endl; 
    6565} 
  • tests/merger_iter_test.cpp

    r203 r211  
    5454        epdf* MP = MM.predictor(xy); 
    5555         
    56         vec Res1 = M.evalpdflog_m(Grid); 
    57         mat Res2 = ((emix*)MP)->evalpdflog_M(Grid); 
     56        vec Res1 = M.evallog_m(Grid); 
     57        mat Res2 = ((emix*)MP)->evallog_M(Grid); 
    5858         
    5959        it_file it("merger_iter_test.it"); 
  • tests/merger_test.cpp

    r203 r211  
    3333        x_grid.set_row ( 0,linspace ( -10.0, 10.0 ) ); 
    3434 
    35         vec l_f1=f1.evalpdflog_m ( x_grid ); 
     35        vec l_f1=f1.evallog_m ( x_grid ); 
    3636 
    37         vec l_f2=f2.evalpdflog_m ( x_grid ); 
     37        vec l_f2=f2.evallog_m ( x_grid ); 
    3838        mat lW(2,Npoints); 
    3939        lW.set_row(0, l_f1); 
     
    4848         
    4949        vec m2 = M.lognorm_merge(lW); 
    50         vec mm2 = M.evalpdflog_m(x_grid); 
     50        vec mm2 = M.evallog_m(x_grid); 
    5151         
    5252        it_file it("merger_test.it"); 
  • tests/test0.cpp

    r170 r211  
    2121                                         "3 4 5 6"); 
    2222        vec v = "1 -1 3 -1"; 
    23          
     23                 
    2424        cout << "Test to_mat"<<endl; 
    2525//      cout << ld << endl; 
  • tests/testSmp.cpp

    r203 r211  
    4343        mlnorm<ldmat> ML(x,x); 
    4444        ML.set_parameters(I,zeros(2),R); 
    45         Smp = ML.samplecond(mu0,lik,N); 
     45        Smp = ML.samplecond_m(mu0,lik,N); 
    4646         
    4747        disp(mu0,R.to_mat(),Smp); 
     
    5353        eG.set_parameters(a,b); 
    5454         
    55         cout << eG.evalpdflog(a)<<endl; 
     55        cout << eG.evallog(a)<<endl; 
    5656        Smp = eG.sample_m(N); 
    5757 
     
    6565        mG.set_parameters(k); 
    6666 
    67         Smp=mG.samplecond(mu0,lik,N); 
     67        Smp=mG.samplecond_m(mu0,lik,N); 
    6868        disp(mu0,pow(mu0,2.0)/k,Smp); 
    6969         
     
    8282        mepdf meMix(&eMix); 
    8383         
    84         Smp = meMix.samplecond(mu0,lik,N); 
     84        Smp = meMix.samplecond_m(mu0,lik,N); 
    8585        disp(eMix.mean(),zeros(2),Smp); 
    8686 
     
    9494        mMix.set_parameters(vec_2(0.5,0.5),mComs); 
    9595         
    96         Smp = mMix.samplecond(mu0,lik,N); 
     96        Smp = mMix.samplecond_m(mu0,lik,N); 
    9797        disp(mMix._epdf().mean(),zeros(2),Smp); 
    9898