Changeset 211
- Timestamp:
- 11/13/08 20:00:53 (16 years ago)
- Files:
-
- 26 modified
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
CMakeLists.txt
r208 r211 27 27 #This is for UNIX makefile which does only one release at a time. 28 28 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") 30 30 INCLUDE(CMakeLocal.txt OPTIONAL) 31 31 ENDIF(WIN32) -
CMake_modules/FindITPP.cmake
r209 r211 11 11 12 12 FIND_PATH(ITPP_INCLUDE_DIR itpp/itbase.h 13 ${ITPP_DIR} 13 ${ITPP_DIR}/include 14 14 /usr/pkgs64/include 15 15 ) … … 17 17 FIND_LIBRARY(ITPP_LIBRARY 18 18 NAMES itpp itpp_debug 19 PATHS $ITPP_DIR 20 /home/smidl/work/git/trunk/itpp/.libs 19 PATHS ${ITPP_DIR}/libs 21 20 "${ITPP_DIR}\\win32\\lib" 22 21 /usr/pkgs64/lib -
bdm/estim/libKF.cpp
r141 r211 158 158 159 159 if ( evalll==true ) { //likelihood of observation y 160 ll=fy.eval pdflog ( y );160 ll=fy.evallog ( y ); 161 161 } 162 162 } … … 232 232 233 233 if ( evalll==true ) { //likelihood of observation y 234 ll=fy.eval pdflog ( y );234 ll=fy.evallog ( y ); 235 235 } 236 236 } -
bdm/estim/libKF.h
r200 r211 332 332 333 333 if ( evalll==true ) { //likelihood of observation y 334 ll=fy.eval pdflog ( y );334 ll=fy.evallog ( y ); 335 335 } 336 336 … … 395 395 ( _mu ) += _K* ( y-_yp ); 396 396 397 if ( evalll==true ) {ll+=fy.eval pdflog ( y );}397 if ( evalll==true ) {ll+=fy.evallog ( y );} 398 398 }; 399 399 -
bdm/estim/libPF.cpp
r60 r211 14 14 //generate new samples from paramater evolution model; 15 15 _samples ( i ) = par.samplecond ( _samples ( i ), lls ( i ) ); 16 lls ( i ) *= obs.eval cond ( dt,_samples ( i ) );16 lls ( i ) *= obs.evallogcond ( dt,_samples ( i ) ); 17 17 18 18 if ( lls ( i ) >mlls ) mlls=lls ( i ); //find maximum -
bdm/estim/libPF.h
r200 r211 94 94 vec sample() const {it_error ( "Not implemented" );return 0;} 95 95 96 double eval pdflog ( 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;} 97 97 }; 98 98 -
bdm/estim/merger.cpp
r205 r211 102 102 // no need for conditioning or marginalization 103 103 for ( int j=0;j<Ns; j++ ) { // Smp is Array<> => for cycle 104 lw_src ( j ) =mpdfs ( i )->_epdf().eval pdflog ( Smp ( j ) );104 lw_src ( j ) =mpdfs ( i )->_epdf().evallog ( Smp ( j ) ); 105 105 } 106 106 } … … 113 113 for ( int k=0;k<Ns;k++ ) { 114 114 // Here val of tmp_marg = cond of mpdfs(i) ==> calling dls->get_cond 115 lw_src ( k ) += tmp_marg->eval pdflog ( dls ( i )->get_cond ( Smp ( k ) ) );115 lw_src ( k ) += tmp_marg->evallog ( dls ( i )->get_cond ( Smp ( k ) ) ); 116 116 } 117 117 delete tmp_marg; … … 130 130 for ( int k= 0; k<Ns; k++ ) { 131 131 lw_src ( k ) += log ( 132 tmp_cond->eval cond (132 tmp_cond->evallogcond ( 133 133 zdls ( i )->get_val ( Smp ( k ) ), 134 134 zdls ( i )->get_cond ( Smp ( k ) ) ) ); … … 142 142 for ( int k= 0; k<Ns; k++ ) { 143 143 mpdfs ( i )->condition ( dls ( i )->get_cond ( Smp ( k ) ) ); 144 lw_src ( k ) += mpdfs ( i )->_epdf().eval pdflog ( dls ( i )->get_val ( Smp ( k ) ) );144 lw_src ( k ) += mpdfs ( i )->_epdf().evallog ( dls ( i )->get_val ( Smp ( k ) ) ); 145 145 } 146 146 -
bdm/estim/merger.h
r205 r211 88 88 //! weight w is a 89 89 vec sample ( ) const { return Mix._epdf().sample();} 90 double eval pdflog ( const vec &dt ) const {90 double evallog ( const vec &dt ) const { 91 91 vec dtf=ones ( dt.length() +1 ); 92 92 dtf.set_subvector ( 0,dt ); -
bdm/stat/emix.h
r204 r211 32 32 In particular this type of arise by conditioning of a mixture model. 33 33 34 At present the only supported operation is eval cond().34 At present the only supported operation is evallogcond(). 35 35 */ 36 36 class mratio: public mpdf { … … 60 60 den = nom->marginal ( rvc ); 61 61 }; 62 double eval cond ( const vec &val, const vec &cond ) {62 double evallogcond ( const vec &val, const vec &cond ) { 63 63 vec nom_val ( rv.count() +rvc.count() ); 64 64 dl.fill_val_cond ( nom_val,val,cond ); 65 return exp ( nom->eval pdflog ( nom_val ) - den->evalpdflog ( cond ) );65 return exp ( nom->evallog ( nom_val ) - den->evallog ( cond ) ); 66 66 } 67 67 //! Object takes ownership of nom and will destroy it … … 102 102 return mu; 103 103 } 104 double eval pdflog ( const vec &val ) const {104 double evallog ( const vec &val ) const { 105 105 int i; 106 106 double sum = 0.0; 107 for ( i = 0;i < w.length();i++ ) {sum += w ( i ) * exp ( Coms ( i )->eval pdflog ( val ) );}107 for ( i = 0;i < w.length();i++ ) {sum += w ( i ) * exp ( Coms ( i )->evallog ( val ) );} 108 108 return log ( sum ); 109 109 }; 110 vec eval pdflog_m ( const mat &Val ) const {110 vec evallog_m ( const mat &Val ) const { 111 111 vec x=zeros ( Val.cols() ); 112 112 for ( int i = 0; i < w.length(); i++ ) { 113 x+= w ( i ) *exp ( Coms ( i )->eval pdflog_m ( Val ) );113 x+= w ( i ) *exp ( Coms ( i )->evallog_m ( Val ) ); 114 114 } 115 115 return log ( x ); 116 116 }; 117 mat eval pdflog_M ( const mat &Val ) const {117 mat evallog_M ( const mat &Val ) const { 118 118 mat X ( w.length(), Val.cols() ); 119 119 for ( int i = 0; i < w.length(); i++ ) { 120 X.set_row ( i, w ( i ) *exp ( Coms ( i )->eval pdflog_m ( Val ) ) );120 X.set_row ( i, w ( i ) *exp ( Coms ( i )->evallog_m ( Val ) ) ); 121 121 } 122 122 return X; … … 166 166 }; 167 167 168 double eval cond ( const vec &val, const vec &cond ) {168 double evallogcond ( const vec &val, const vec &cond ) { 169 169 int i; 170 170 double res = 1.0; … … 174 174 } 175 175 // add logarithms 176 res += epdfs ( i )->eval pdflog ( dls ( i )->get_val ( val ) );*/177 res *= mpdfs ( i )->eval cond (176 res += epdfs ( i )->evallog ( dls ( i )->get_val ( val ) );*/ 177 res *= mpdfs ( i )->evallogcond ( 178 178 dls ( i )->get_val ( val ), 179 179 dls ( i )->get_cond ( val, cond ) … … 196 196 dls ( i )->fill_val ( smp, smpi ); 197 197 // add ith likelihood contribution 198 ll+=epdfs ( i )->eval pdflog ( smpi );198 ll+=epdfs ( i )->evallog ( smpi ); 199 199 } 200 200 return smp; … … 244 244 return tmp; 245 245 } 246 double eval pdflog ( const vec &val ) const {246 double evallog ( const vec &val ) const { 247 247 double tmp=0; 248 248 for ( int i=0;i<epdfs.length();i++ ) { 249 tmp+=epdfs ( i )->eval pdflog ( dls ( i )->get_val ( val ) );249 tmp+=epdfs ( i )->evallog ( dls ( i )->get_val ( val ) ); 250 250 } 251 251 return tmp; -
bdm/stat/libBM.cpp
r201 r211 8 8 9 9 static int RVcounter=0; 10 11 RV RV0=RV(); 10 12 11 13 void RV::init ( ivec in_ids, Array<std::string> in_names, ivec in_sizes, ivec in_times ) { -
bdm/stat/libBM.h
r203 r211 126 126 RV concat ( const RV &rv1, const RV &rv2 ); 127 127 128 //!Default empty RV that can be used as default argument 129 extern RV RV0; 128 130 129 131 //! Class representing function \f$f(x)\f$ of variable \f$x\f$ represented by \c rv … … 172 174 173 175 //! Compute log-probability of argument \c val 174 virtual double eval pdflog ( const vec &val ) const =0;176 virtual double evallog ( const vec &val ) const =0; 175 177 176 178 //! Compute log-probability of multiple values argument \c val 177 virtual vec eval pdflog_m ( const mat &Val ) const {179 virtual vec evallog_m ( const mat &Val ) const { 178 180 vec x ( Val.cols() ); 179 for ( int i=0;i<Val.cols();i++ ) {x ( i ) =eval pdflog ( Val.get_col ( i ) ) ;}181 for ( int i=0;i<Val.cols();i++ ) {x ( i ) =evallog ( Val.get_col ( i ) ) ;} 180 182 return x; 181 183 } … … 217 219 this->condition ( cond ); 218 220 vec temp= ep->sample(); 219 ll=ep->eval pdflog ( temp );return temp;221 ll=ep->evallog ( temp );return temp; 220 222 }; 221 223 //! 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 ) { 223 225 this->condition ( cond ); 224 226 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->eval pdflog ( smp );}227 for ( int i=0;i<N;i++ ) {smp=ep->sample() ;temp.set_col ( i, smp );ll ( i ) =ep->evallog ( smp );} 226 228 return temp; 227 229 }; … … 230 232 231 233 //! 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 );}; 235 238 236 239 //! Destructor for future use; -
bdm/stat/libEF.cpp
r198 r211 19 19 } 20 20 21 double egiw::eval pdflog_nn ( const vec &val ) const {21 double egiw::evallog_nn ( const vec &val ) const { 22 22 int vend = val.length()-1; 23 23 … … 128 128 // } 129 129 130 double egamma::eval pdflog ( const vec &val ) const {130 double egamma::evallog ( const vec &val ) const { 131 131 double res = 0.0; //the rest will be added 132 132 int i; -
bdm/stat/libEF.h
r205 r211 46 46 virtual void dupdate ( mat &v ) {it_error ( "Not implemented" );}; 47 47 //!Evaluate normalized log-probability 48 virtual double eval pdflog_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;}; 49 49 //!Evaluate normalized log-probability 50 virtual double eval pdflog ( 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;} 51 51 //!Evaluate normalized log-probability for many samples 52 virtual vec eval pdflog ( const mat &Val ) const {52 virtual vec evallog ( const mat &Val ) const { 53 53 vec x ( Val.cols() ); 54 for ( int i=0;i<Val.cols();i++ ) {x ( i ) =eval pdflog_nn ( Val.get_col ( i ) ) ;}54 for ( int i=0;i<Val.cols();i++ ) {x ( i ) =evallog_nn ( Val.get_col ( i ) ) ;} 55 55 return x-lognc(); 56 56 } … … 129 129 mat sample ( int N ) const; 130 130 double eval ( const vec &val ) const ; 131 double eval pdflog_nn ( const vec &val ) const;131 double evallog_nn ( const vec &val ) const; 132 132 double lognc () const; 133 133 vec mean() const {return mu;} … … 193 193 void mean_mat ( mat &M, mat&R ) const; 194 194 //! In this instance, val= [theta, r]. For multivariate instances, it is stored columnwise val = [theta_1 theta_2 ... r_1 r_2 ] 195 double eval pdflog_nn ( const vec &val ) const;195 double evallog_nn ( const vec &val ) const; 196 196 double lognc () const; 197 197 … … 227 227 vec mean() const {return beta/sum ( beta );}; 228 228 //! In this instance, val is ... 229 double eval pdflog_nn ( const vec &val ) const {return ( beta-1 ) *log ( val );};229 double evallog_nn ( const vec &val ) const {return ( beta-1 ) *log ( val );}; 230 230 double lognc () const { 231 231 double gam=sum ( beta ); … … 318 318 //! TODO: is it used anywhere? 319 319 // mat sample ( int N ) const; 320 double eval pdflog ( const vec &val ) const;320 double evallog ( const vec &val ) const; 321 321 double lognc () const; 322 322 //! Returns poiter to alpha and beta. Potentially dengerous: use with care! … … 358 358 euni ( const RV rv ) :epdf ( rv ) {} 359 359 double eval ( const vec &val ) const {return nk;} 360 double eval pdflog ( const vec &val ) const {return lnk;}360 double evallog ( const vec &val ) const {return lnk;} 361 361 vec sample() const { 362 362 vec smp ( rv.count() ); … … 538 538 vec sample() const {it_error ( "Not implemented" );return 0;} 539 539 //! inherited operation : NOT implemneted 540 double eval pdflog ( 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;} 541 541 vec mean() const { 542 542 vec pom=zeros ( rv.count() ); … … 599 599 double enorm<sq_T>::eval ( const vec &val ) const { 600 600 double pdfl,e; 601 pdfl = eval pdflog ( val );601 pdfl = evallog ( val ); 602 602 e = exp ( pdfl ); 603 603 return e; … … 605 605 606 606 template<class sq_T> 607 double enorm<sq_T>::eval pdflog_nn ( const vec &val ) const {607 double enorm<sq_T>::evallog_nn ( const vec &val ) const { 608 608 // 1.83787706640935 = log(2pi) 609 609 double tmp=-0.5* ( R.invqform ( mu-val ) );// - lognc(); -
mpdm/merg_2a.cpp
r205 r211 13 13 // Setup model 14 14 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; 22 27 // 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 34 32 35 33 //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; // 38 35 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 ); 43 38 44 39 //Test estimation … … 47 42 48 43 // Logging 49 dirfilelog L ( "exp/merg_ giw",ndat );44 dirfilelog L ( "exp/merg_2a",ndat ); 50 45 int Li_Data = L.add ( RV ( "{Y U1 U2 }" ), "" ); 51 46 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" ); 56 49 L.init(); 57 50 58 51 vec Yt ( ndat ); 59 52 vec yt ( 1 ); 60 61 vec LLs ( 2 );62 vec rgrg ( 2 );63 53 64 54 //Proposal … … 96 86 Array<mpdf*> A ( 2 ); A ( 0 ) =&eG1;A ( 1 ) =&eG2; 97 87 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); 99 89 //M2.set_parameters ( 100.0, 1000,3 ); //M2._Mix().set_method(QB); 100 90 M.merge ( &G0 ); -
mpdm/merg_giw.cpp
r205 r211 104 104 yt ( 0 ) = Yt ( t ); 105 105 106 // LLs ( 0 ) = P1._e()->eval pdflog ( get_vec(Th, "1 2") );107 // LLs ( 1 ) = P2._e()->eval pdflog ( get_vec(Th, "3 2") );108 LLs ( 0 ) = PG._e()->eval pdflog ( 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 ); 109 109 LLs ( 1 ) = M._Mix().logpred ( concat ( Thj, vec_1 ( 1.0 ) ) ); 110 110 // LLs ( 3 ) = M2._Mix().logpred ( concat(Thj, vec_1(1.0)) ); -
mpdm/merg_pred.cpp
r204 r211 94 94 95 95 yt(0) = Yt(t); 96 double P1pl = P1p->eval cond(yt,rgr1);97 double P2pl = P2p->eval cond(yt,rgr2);98 double PGpl = Pgp->eval cond(yt,rgrg);96 double P1pl = P1p->evallogcond(yt,rgr1); 97 double P2pl = P2p->evallogcond(yt,rgr2); 98 double PGpl = Pgp->evallogcond(yt,rgrg); 99 99 { 100 100 cout << "yt: " << yt << endl; … … 113 113 mlnorm<ldmat>* cP2p = (mlnorm<ldmat>*)mP2p->condition(y); 114 114 115 cP1pl = cP1p->eval cond(yt,rgr1);116 cP2pl = cP2p->eval cond(yt,rgr2);115 cP1pl = cP1p->evallogcond(yt,rgr1); 116 cP2pl = cP2p->evallogcond(yt,rgr2); 117 117 118 118 cout << "ytm1: " << cP1p->_epdf().mean() << endl; -
tests/arx_elem_test.cpp
r201 r211 40 40 41 41 mlstudent* Ap = Ar.predictor_student(RV("{y }"),RV("{1 }")); 42 vec Ap_x=Ap->eval cond_m(X,vec_1(1.0));42 vec Ap_x=Ap->evallogcond_m(X,vec_1(1.0)); 43 43 vec ll_x = Ar.logpred_m(X2); 44 44 -
tests/arx_test.cpp
r198 r211 41 41 cout << "y: " << Yt(t) << endl; 42 42 mlstudent* Pr = Ar.predictor_student(RV("{y }"),RV("{y1 y2 y3 y4 }")); 43 cout << Ar._ll() <<" , " << log(Pr->eval cond(vec_1(Yt(t)),rgr)) <<endl;43 cout << Ar._ll() <<" , " << log(Pr->evallogcond(vec_1(Yt(t)),rgr)) <<endl; 44 44 delete Pr; 45 45 } -
tests/blas_test.cpp
r141 r211 6 6 using std::cout; 7 7 using std::endl; 8 9 //#define NDEBUG 8 10 9 11 mat matmul ( mat &A, mat &B ) { -
tests/egiw_test.cpp
r188 r211 44 44 t_val ( 1 ) = Si ( j ); 45 45 46 pdf ( i,j ) =E.eval pdflog ( t_val );46 pdf ( i,j ) =E.evallog ( t_val ); 47 47 } 48 48 } … … 97 97 t_val ( 2 ) = ( j+1 ) * ( 1.0/n ) *2.0; 98 98 99 Tmp ( i,j ) = E.eval pdflog ( t_val );99 Tmp ( i,j ) = E.evallog ( t_val ); 100 100 } 101 101 } -
tests/emix_test.cpp
r203 r211 19 19 for ( double y=yb ( 0 );y<=yb ( 1 );y+=ystep,j++ ) { 20 20 rgr ( 1 ) =y; 21 PPdf ( i,j ) =exp ( ep->eval pdflog ( rgr ) );21 PPdf ( i,j ) =exp ( ep->evallog ( rgr ) ); 22 22 } 23 23 } … … 58 58 cout << *((mlnorm<ldmat>*)Ac) <<endl; 59 59 60 cout << "Mix marg at 0: " << Mm->eval pdflog(vec_1(0.0)) <<endl;61 cout << "ARX marg at 0: " << Am->eval pdflog(vec_1(0.0)) <<endl;62 cout << "Mix cond at 0,0: " << Mc->eval cond(vec_1(0.0),vec_1(0.0)) <<endl;63 cout << "ARX cond at 0,0: " << Ac->eval cond(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; 64 64 65 65 cout << "======== Mixture with two components ==="<<endl; … … 78 78 vec ll2 ( N ); 79 79 mat Smp=M2.sample_m ( N ); 80 ll = M2.eval pdflog_m(Smp);80 ll = M2.evallog_m(Smp); 81 81 82 82 vec Emu = sum ( Smp,2 ) /N; … … 102 102 103 103 for (int j=0; j<N; j++){ 104 ll2(j)=mEp.eval cond (Smp.get_col(j), vec ( 0 ));104 ll2(j)=mEp.evallogcond (Smp.get_col(j), vec ( 0 )); 105 105 } 106 106 it << Name("ll") << ll; -
tests/enorm_test.cpp
r203 r211 19 19 for ( double y=yb ( 0 );y<=yb ( 1 );y+=ystep,j++ ) { 20 20 rgr ( 1 ) =y; 21 PPdf ( i,j ) =exp ( ep->eval pdflog ( rgr ) );21 PPdf ( i,j ) =exp ( ep->evallog ( rgr ) ); 22 22 } 23 23 } … … 73 73 74 74 cout << endl << " test of pdflog at zero "<<endl; 75 cout << "original: " << exp(E.eval pdflog(vec("0 0"))) <<endl;76 cout << "composite: " << mEp.eval cond(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; 77 77 } -
tests/merger_2d_test.cpp
r205 r211 52 52 emix* MP = MM.predictor(xy); 53 53 54 vec Res1 = M.eval pdflog_m(Grid);55 mat Res2 = (MP)->eval pdflog_M(Grid);54 vec Res1 = M.evallog_m(Grid); 55 mat Res2 = (MP)->evallog_M(Grid); 56 56 57 57 it_file it("merger_2d_test.it"); … … 60 60 it << Name("Res1") << Res1; 61 61 it << Name("Res2") << Res2; 62 it << Name("S1") << f1.eval pdflog_m(Grid);63 it << Name("S2") << f2.eval pdflog_m(Grid);62 it << Name("S1") << f1.evallog_m(Grid); 63 it << Name("S2") << f2.evallog_m(Grid); 64 64 cout << ((enorm<ldmat>*)(MP->_Coms(0)))->_R().to_mat() << endl; 65 65 } -
tests/merger_iter_test.cpp
r203 r211 54 54 epdf* MP = MM.predictor(xy); 55 55 56 vec Res1 = M.eval pdflog_m(Grid);57 mat Res2 = ((emix*)MP)->eval pdflog_M(Grid);56 vec Res1 = M.evallog_m(Grid); 57 mat Res2 = ((emix*)MP)->evallog_M(Grid); 58 58 59 59 it_file it("merger_iter_test.it"); -
tests/merger_test.cpp
r203 r211 33 33 x_grid.set_row ( 0,linspace ( -10.0, 10.0 ) ); 34 34 35 vec l_f1=f1.eval pdflog_m ( x_grid );35 vec l_f1=f1.evallog_m ( x_grid ); 36 36 37 vec l_f2=f2.eval pdflog_m ( x_grid );37 vec l_f2=f2.evallog_m ( x_grid ); 38 38 mat lW(2,Npoints); 39 39 lW.set_row(0, l_f1); … … 48 48 49 49 vec m2 = M.lognorm_merge(lW); 50 vec mm2 = M.eval pdflog_m(x_grid);50 vec mm2 = M.evallog_m(x_grid); 51 51 52 52 it_file it("merger_test.it"); -
tests/test0.cpp
r170 r211 21 21 "3 4 5 6"); 22 22 vec v = "1 -1 3 -1"; 23 23 24 24 cout << "Test to_mat"<<endl; 25 25 // cout << ld << endl; -
tests/testSmp.cpp
r203 r211 43 43 mlnorm<ldmat> ML(x,x); 44 44 ML.set_parameters(I,zeros(2),R); 45 Smp = ML.samplecond (mu0,lik,N);45 Smp = ML.samplecond_m(mu0,lik,N); 46 46 47 47 disp(mu0,R.to_mat(),Smp); … … 53 53 eG.set_parameters(a,b); 54 54 55 cout << eG.eval pdflog(a)<<endl;55 cout << eG.evallog(a)<<endl; 56 56 Smp = eG.sample_m(N); 57 57 … … 65 65 mG.set_parameters(k); 66 66 67 Smp=mG.samplecond (mu0,lik,N);67 Smp=mG.samplecond_m(mu0,lik,N); 68 68 disp(mu0,pow(mu0,2.0)/k,Smp); 69 69 … … 82 82 mepdf meMix(&eMix); 83 83 84 Smp = meMix.samplecond (mu0,lik,N);84 Smp = meMix.samplecond_m(mu0,lik,N); 85 85 disp(eMix.mean(),zeros(2),Smp); 86 86 … … 94 94 mMix.set_parameters(vec_2(0.5,0.5),mComs); 95 95 96 Smp = mMix.samplecond (mu0,lik,N);96 Smp = mMix.samplecond_m(mu0,lik,N); 97 97 disp(mMix._epdf().mean(),zeros(2),Smp); 98 98