Changeset 713 for library/tests
- Timestamp:
- 11/10/09 11:03:09 (15 years ago)
- Location:
- library/tests
- Files:
-
- 1 added
- 10 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/CMakeLists.txt
r700 r713 41 41 # using UnitTest++ 42 42 43 SET(unit_test_configurations egiw.cfg mlnorm.cfg edirich.cfg mprod.cfg generator.cfg epdfds.cfg pdfds.cfg test_user_info_input.cfg merger.cfg erroneous.cfg egamma.cfg test_user_info_external.cfg merger_error.cfg mgamma.cfg enorm.cfg )43 SET(unit_test_configurations egiw.cfg mlnorm.cfg edirich.cfg mprod.cfg generator.cfg epdfds.cfg pdfds.cfg test_user_info_input.cfg merger.cfg erroneous.cfg egamma.cfg test_user_info_external.cfg merger_error.cfg mgamma.cfg enorm.cfg mmix.cfg emix.cfg) 44 44 45 45 add_executable(testsuite arx_straux_test.cpp datalink_test.cpp datasource_test.cpp egiw_test.cpp emix_test.cpp epdf_test.cpp logger_test.cpp LQG_test.cpp merger_test.cpp -
library/tests/arx_elem_test.cpp
r682 r713 38 38 39 39 mlstudent* Ap = Ar.predictor_student(); 40 vec Ap_x = Ap->evallogcond_m ( X, empty_vec );41 vec ll_x = Ar.logpred_m ( X2 );40 vec Ap_x = Ap->evallogcond_mat ( X, empty_vec ); 41 vec ll_x = Ar.logpred_mat ( X2 ); 42 42 43 43 cout << "normalize : " << xstep*sum ( exp ( Ap_x ) ) << endl; -
library/tests/emix_test.cpp
r693 r713 68 68 69 69 int N = 3; 70 mat Smp = M2.sample_m ( N );70 mat Smp = M2.sample_mat ( N ); 71 71 72 72 vec exp_ll ( "-5.0 -2.53563 -2.62171" ); 73 vec ll = M2.evallog_m ( Smp );73 vec ll = M2.evallog_mat ( Smp ); 74 74 CHECK_CLOSE ( exp_ll, ll, 5.0 ); 75 75 … … 115 115 Array<vec> actual(CurrentContext::max_trial_count); 116 116 do { 117 mat smp = distrib_obj.sample_m ( nsamples );117 mat smp = distrib_obj.sample_mat ( nsamples ); 118 118 vec emu = sum ( smp, 2 ) / nsamples; 119 119 actual( tc ) = emu; … … 135 135 Array<mat> actual(CurrentContext::max_trial_count); 136 136 do { 137 mat smp = distrib_obj.sample_m ( nsamples );137 mat smp = distrib_obj.sample_mat ( nsamples ); 138 138 vec emu = sum ( smp, 2 ) / nsamples; 139 139 mat er = ( smp * smp.T() ) / nsamples - outer_product ( emu, emu ); -
library/tests/epdf_harness.cpp
r706 r713 95 95 } 96 96 97 vec lpzv_act = hepdf->evallog_m ( zero1n );97 vec lpzv_act = hepdf->evallog_mat ( zero1n ); 98 98 CHECK_CLOSE_EX ( lpzv, lpzv_act, tolerance ); 99 99 … … 105 105 } 106 106 107 lpzv_act = hepdf->evallog_m ( zeroa );107 lpzv_act = hepdf->evallog_mat ( zeroa ); 108 108 CHECK_CLOSE_EX ( lpzv, lpzv_act, tolerance ); 109 109 } … … 162 162 Array<vec> actual(CurrentContext::max_trial_count); 163 163 do { 164 mat smp = hepdf->sample_m ( nsamples );164 mat smp = hepdf->sample_mat ( nsamples ); 165 165 vec emu = smp * ones ( nsamples ) / nsamples; 166 166 actual( tc ) = emu; … … 183 183 Array<mat> actual(CurrentContext::max_trial_count); 184 184 do { 185 mat smp = hepdf->sample_m ( nsamples );185 mat smp = hepdf->sample_mat ( nsamples ); 186 186 vec emu = smp * ones ( nsamples ) / nsamples; 187 187 mat er = ( smp * smp.T() ) / nsamples - outer_product ( emu, emu ); … … 208 208 Array<vec> actual(CurrentContext::max_trial_count); 209 209 do { 210 mat smp = mep.samplecond_m ( vec ( 0 ), nsamples );210 mat smp = mep.samplecond_mat ( vec ( 0 ), nsamples ); 211 211 vec emu = sum ( smp, 2 ) / nsamples; 212 212 actual( tc ) = emu; … … 229 229 Array<mat> actual(CurrentContext::max_trial_count); 230 230 do { 231 mat smp = mep.samplecond_m ( vec ( 0 ), nsamples );231 mat smp = mep.samplecond_mat ( vec ( 0 ), nsamples ); 232 232 vec emu = sum ( smp, 2 ) / nsamples; 233 233 mat er = ( smp * smp.T() ) / nsamples - outer_product ( emu, emu ); -
library/tests/merger_2d_test.cpp
r693 r713 58 58 emix* MP = MM.epredictor(); //xy 59 59 60 vec Res1 = M.evallog_m ( Grid );61 mat Res2 = ( MP )->evallog_ M( Grid );60 vec Res1 = M.evallog_mat ( Grid ); 61 mat Res2 = ( MP )->evallog_mat ( Grid ); 62 62 63 63 it_file it ( "merger_2d_test.it" ); … … 66 66 it << Name ( "Res1" ) << Res1; 67 67 it << Name ( "Res2" ) << Res2; 68 it << Name ( "S1" ) << f1->evallog_m ( Grid );69 it << Name ( "S2" ) << f2->evallog_m ( Grid );68 it << Name ( "S1" ) << f1->evallog_mat ( Grid ); 69 it << Name ( "S2" ) << f2->evallog_mat ( Grid ); 70 70 cout << ( ( enorm<ldmat>* ) ( MP->_Coms ( 0 ).get() ) )->_R().to_mat() << endl; 71 71 } -
library/tests/merger_iter_test.cpp
r693 r713 60 60 epdf* MP = MM.epredictor();//xy 61 61 62 vec Res1 = M.evallog_m ( Grid );63 mat Res2 = ( ( emix* ) MP )->evallog_ M( Grid );62 vec Res1 = M.evallog_mat ( Grid ); 63 mat Res2 = ( ( emix* ) MP )->evallog_mat ( Grid ); 64 64 65 65 it_file it ( "merger_iter_test.it" ); -
library/tests/merger_test.cpp
r693 r713 29 29 x_grid.set_row ( 0, linspace ( -10.0, 10.0 ) ); 30 30 31 vec l_f1 = f1->evallog_m ( x_grid );32 vec l_f2 = f2->evallog_m ( x_grid );31 vec l_f1 = f1->evallog_mat ( x_grid ); 32 vec l_f2 = f2->evallog_mat ( x_grid ); 33 33 mat lW ( 2, Npoints ); 34 34 lW.set_row ( 0, l_f1 ); -
library/tests/mixtures_test.cpp
r679 r713 69 69 // Sample parameters 70 70 int ndat = 100; 71 mat Smp = Simul.sample_m ( ndat );71 mat Smp = Simul.sample_mat ( ndat ); 72 72 73 73 cout << "Simulated means: " << m1 << " and " << m2 << endl; -
library/tests/pdf_harness.cpp
r706 r713 50 50 Array<vec> actual(CurrentContext::max_trial_count); 51 51 do { 52 mat smp = hpdf->samplecond_m ( cond, nsamples );52 mat smp = hpdf->samplecond_mat ( cond, nsamples ); 53 53 vec emu = smp * ones ( nsamples ) / nsamples; 54 54 actual( tc ) = emu; … … 71 71 Array<mat> actual(CurrentContext::max_trial_count); 72 72 do { 73 mat smp = hpdf->samplecond_m ( cond, nsamples );73 mat smp = hpdf->samplecond_mat ( cond, nsamples ); 74 74 vec emu = smp * ones ( nsamples ) / nsamples; 75 75 mat er = ( smp * smp.T() ) / nsamples - outer_product ( emu, emu ); -
library/tests/pdf_test.cpp
r706 r713 13 13 static void check_covariance(mmix &distrib_obj, const vec &mu0, int nsamples, const mat &R, double tolerance); 14 14 15 TEST ( mepdf_test ) {16 pdf_harness::test_config ( "mepdf.cfg" );17 }18 19 15 TEST ( mgamma_test ) { 20 16 pdf_harness::test_config ( "mgamma.cfg" ); … … 29 25 } 30 26 31 // not using pdf_harness because mmix isn't configurable (yet?)32 27 TEST ( mmix_test ) { 28 pdf_harness::test_config ( "mmix.cfg" ); 29 //vec tmu = 0.5 * eN->mean() + 0.5 * mu0; 30 31 /* 33 32 RV x ( "{mmixx }", "2" ); 34 33 RV y ( "{mmixy }", "2" ); … … 63 62 mat observedR ( "1.27572 0.778247; 0.778247 3.33129" ); 64 63 check_covariance( mMix, mu0, N, observedR, 0.2 ); 64 */ 65 65 } 66 66 67 67 // not using pdf_harness because emix isn't configurable (yet?) 68 TEST ( mepdf_emix_test ) { 68 TEST ( emix_test ) { 69 pdf_harness::test_config ( "emix.cfg" ); 70 /* 69 71 int N = 10000; //number of samples 70 72 vec mu0 ( "1.5 1.7" ); … … 87 89 eMix->set_parameters ( vec_2 ( 0.5, 0.5 ), Coms ); 88 90 check_mean ( *eMix, mu0, N, eMix->mean(), 0.1 ); 91 */ 89 92 } 90 93 … … 93 96 Array<vec> actual(CurrentContext::max_trial_count); 94 97 do { 95 mat smp = distrib_obj.samplecond_m ( mu0, nsamples );98 mat smp = distrib_obj.samplecond_mat ( mu0, nsamples ); 96 99 vec emu = smp * ones ( nsamples ) / nsamples ; 97 100 actual( tc ) = emu; … … 113 116 Array<mat> actual(CurrentContext::max_trial_count); 114 117 do { 115 mat smp = distrib_obj.samplecond_m ( mu0, nsamples );118 mat smp = distrib_obj.samplecond_mat ( mu0, nsamples ); 116 119 vec emu = smp * ones ( nsamples ) / nsamples ; 117 120 mat er = ( smp * smp.T() ) / nsamples - outer_product ( emu, emu );