Changeset 522

Show
Ignore:
Timestamp:
08/13/09 12:21:38 (15 years ago)
Author:
vbarta
Message:

more emix tests

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/emix_test.cpp

    r520 r522  
    1414static void check_covariance ( emix &distrib_obj, int nsamples, const mat &R, double tolerance); 
    1515 
    16 TEST ( test_emix_old ) { 
    17         RV x ( "{x }" ); 
    18         RV y ( "{y }" ); 
     16TEST ( test_emix_1 ) { 
     17        RV x ( "{emixx }" ); 
     18        RV y ( "{emixy }" ); 
    1919        RV xy = concat ( x, y ); 
    2020        vec mu0 ( "1.00054 1.0455" ); 
     
    8989} 
    9090 
     91TEST ( test_emix_2 ) { 
     92        int N = 10000; //number of samples 
     93        vec mu0 ( "1.5 1.7" ); 
     94        mat V0 ( "1.2 0.3; 0.3 5" ); 
     95        ldmat R = ldmat ( V0 ); 
     96 
     97        shared_ptr<enorm<ldmat> > eN = new enorm<ldmat>(); 
     98        eN->set_parameters ( mu0, R ); 
     99 
     100        vec a = "100000,10000"; 
     101        vec b = a / 10.0; 
     102        shared_ptr<egamma> eG = new egamma(); 
     103        eG->set_parameters ( a, b ); 
     104 
     105        emix eMix; 
     106        Array<shared_ptr<epdf> > Coms ( 2 ); 
     107        Coms ( 0 ) = eG; 
     108        Coms ( 1 ) = eN; 
     109 
     110        eMix.set_parameters ( vec_2 ( 0.5, 0.5 ), Coms ); 
     111        check_mean ( eMix, N, eMix.mean(), 0.1 ); 
     112} 
     113 
    91114static void check_mean ( emix &distrib_obj, int nsamples, const vec &mean, double tolerance ) { 
    92115        int tc = 0;