Changeset 529 for library/tests/emix_test.cpp
- Timestamp:
- 08/14/09 09:03:02 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/emix_test.cpp
r522 r529 1 #include "shared_ptr.h"2 1 #include "stat/exp_family.h" 3 2 #include "stat/emix.h" … … 20 19 vec mu0 ( "1.00054 1.0455" ); 21 20 22 shared_ptr<enorm<ldmat> > E1 = new enorm<ldmat>();21 enorm_ldmat_ptr E1; 23 22 E1->set_rv ( xy ); 24 23 E1->set_parameters ( mu0 , mat ( "0.740142 -0.259015; -0.259015 1.0302" ) ); 25 24 26 shared_ptr<enorm<ldmat> > E2 = new enorm<ldmat>();25 enorm_ldmat_ptr E2; 27 26 E2->set_rv ( xy ); 28 27 E2->set_parameters ( "-1.2 -0.1" , mat ( "1 0.4; 0.4 0.5" ) ); 29 28 30 Array<shared_ptr<epdf> >A1 ( 1 );29 epdf_array A1 ( 1 ); 31 30 A1 ( 0 ) = E1; 32 31 … … 36 35 37 36 // test if ARX and emix with one ARX are the same 38 shared_ptr<epdf>Mm = M1.marginal ( y );39 shared_ptr<epdf>Am = E1->marginal ( y );40 shared_ptr<mpdf>Mc = M1.condition ( y );41 shared_ptr<mpdf>Ac = E1->condition ( y );37 epdf_ptr Mm = M1.marginal ( y ); 38 epdf_ptr Am = E1->marginal ( y ); 39 mpdf_ptr Mc = M1.condition ( y ); 40 mpdf_ptr Ac = E1->condition ( y ); 42 41 43 42 mlnorm<ldmat> *wacnd = dynamic_cast<mlnorm<ldmat> *>( Ac.get() ); … … 56 55 57 56 // mixture with two components 58 Array<shared_ptr<epdf> >A2 ( 2 );57 epdf_array A2 ( 2 ); 59 58 A2 ( 0 ) = E1; 60 59 A2 ( 1 ) = E2; … … 80 79 check_covariance ( M2, N, observedR, 2.0); 81 80 82 shared_ptr<epdf>Mg = M2.marginal ( y );81 epdf_ptr Mg = M2.marginal ( y ); 83 82 CHECK ( Mg.get() ); 84 shared_ptr<mpdf>Cn = M2.condition ( x );83 mpdf_ptr Cn = M2.condition ( x ); 85 84 CHECK ( Cn.get() ); 86 85 … … 90 89 91 90 TEST ( test_emix_2 ) { 92 int N = 10000; // number of samples91 int N = 10000; // number of samples 93 92 vec mu0 ( "1.5 1.7" ); 94 93 mat V0 ( "1.2 0.3; 0.3 5" ); 95 94 ldmat R = ldmat ( V0 ); 96 95 97 shared_ptr<enorm<ldmat> > eN = new enorm<ldmat>();96 enorm_ldmat_ptr eN; 98 97 eN->set_parameters ( mu0, R ); 99 98 100 99 vec a = "100000,10000"; 101 100 vec b = a / 10.0; 102 shared_ptr<egamma> eG = new egamma();101 egamma_ptr eG; 103 102 eG->set_parameters ( a, b ); 104 103 105 104 emix eMix; 106 Array<shared_ptr<epdf> >Coms ( 2 );105 epdf_array Coms ( 2 ); 107 106 Coms ( 0 ) = eG; 108 107 Coms ( 1 ) = eN;