- Timestamp:
- 08/20/08 15:41:21 (16 years ago)
- Location:
- tests
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
tests/CMakeLists.txt
r144 r145 34 34 add_executable (blas_test blas_test.cpp) 35 35 target_link_libraries (blas_test ${ITppLibs}) 36 37 add_executable (rv_test rv_test.cpp) 38 target_link_libraries (rv_test ${BdmLibs}) 36 39 37 40 add_executable (test0 test0.cpp) -
tests/testSmp.cpp
r125 r145 24 24 RNG_randomize(); 25 25 26 RV rv("1","{x }","2","0"); 26 RV x("1","{x }","2","0"); 27 RV y("2","{y }","2","0"); 27 28 int N = 10000; //number of samples 28 29 vec mu0 = "1.5 1.7"; … … 31 32 32 33 cout << "====== ENorm ====== " <<endl; 33 enorm<ldmat> eN( rv);34 enorm<ldmat> eN(x); 34 35 eN.set_parameters(mu0,R); 35 36 mat Smp = eN.sample(N); … … 40 41 mat I = eye(2); 41 42 vec lik(N); 42 mlnorm<ldmat> ML( rv,rv);43 mlnorm<ldmat> ML(x,x); 43 44 ML.set_parameters(I,R); 44 45 Smp = ML.samplecond(mu0,lik,N); … … 49 50 vec a = "100000,10000"; 50 51 vec b = a/10.0; 51 egamma eG( rv);52 egamma eG(x); 52 53 eG.set_parameters(a,b); 53 54 … … 60 61 61 62 cout << "====== MGamma ====== " <<endl; 62 mgamma mG( rv,rv);63 mgamma mG(x,x); 63 64 double k = 10.0; 64 65 mG.set_parameters(k); … … 68 69 69 70 cout << "======= EMix ======== " << endl; 70 emix eMix( rv);71 emix eMix(x); 71 72 Array<epdf*> Coms(2); 72 73 Coms(0) = &eG; … … 79 80 80 81 cout << "======= MEpdf ======== " << endl; 81 mepdf meMix( rv,rv,&eMix);82 mepdf meMix(eMix); 82 83 83 84 Smp = meMix.samplecond(mu0,lik,N); … … 85 86 86 87 cout << "======= MMix ======== " << endl; 87 mmix mMix( rv,rv);88 mmix mMix(x,x); 88 89 Array<mpdf*> mComs(2); 89 90 mComs(0) = &mG; 90 91 eN.set_mu(vec_2(0.0,0.0)); 91 mepdf mEnorm( rv,rv,&eN);92 mepdf mEnorm(eN); 92 93 mComs(1) = &mEnorm; 93 94 mMix.set_parameters(vec_2(0.5,0.5),mComs); … … 96 97 disp(mMix._epdf().mean(),zeros(2),Smp); 97 98 99 cout << "======= EProd ======== " << endl; 100 // we have to change eG.rv to y 101 eG._rv()= y; 102 //create array 103 Array<epdf*> A(2); 104 A(0) = &eN; 105 A(1) = &eG; 106 107 eprod eP(A); 108 mat epV=zeros(4,4); 109 epV.set_submatrix(0,0,V0); 110 epV.set_submatrix(2,2,diag(g_var)); 111 Smp = eP.sampleN(N); 112 disp(eP.mean(), epV,Smp); 113 98 114 //Exit program: 99 115 return 0;