Changeset 145 for tests

Show
Ignore:
Timestamp:
08/20/08 15:41:21 (16 years ago)
Author:
smidl
Message:

Oprava dokumentace

Location:
tests
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • tests/CMakeLists.txt

    r144 r145  
    3434add_executable (blas_test blas_test.cpp) 
    3535target_link_libraries (blas_test ${ITppLibs}) 
     36 
     37add_executable (rv_test rv_test.cpp) 
     38target_link_libraries (rv_test ${BdmLibs}) 
    3639 
    3740add_executable (test0 test0.cpp) 
  • tests/testSmp.cpp

    r125 r145  
    2424        RNG_randomize(); 
    2525 
    26         RV rv("1","{x }","2","0"); 
     26        RV x("1","{x }","2","0"); 
     27        RV y("2","{y }","2","0"); 
    2728        int N = 10000; //number of samples 
    2829        vec mu0 = "1.5 1.7"; 
     
    3132         
    3233        cout << "====== ENorm ====== " <<endl; 
    33         enorm<ldmat> eN(rv); 
     34        enorm<ldmat> eN(x); 
    3435        eN.set_parameters(mu0,R); 
    3536        mat Smp = eN.sample(N); 
     
    4041        mat I = eye(2); 
    4142        vec lik(N); 
    42         mlnorm<ldmat> ML(rv,rv); 
     43        mlnorm<ldmat> ML(x,x); 
    4344        ML.set_parameters(I,R); 
    4445        Smp = ML.samplecond(mu0,lik,N); 
     
    4950        vec a = "100000,10000"; 
    5051        vec b = a/10.0; 
    51         egamma eG(rv); 
     52        egamma eG(x); 
    5253        eG.set_parameters(a,b); 
    5354         
     
    6061 
    6162        cout << "====== MGamma ====== " <<endl;  
    62         mgamma mG(rv,rv); 
     63        mgamma mG(x,x); 
    6364        double k = 10.0; 
    6465        mG.set_parameters(k); 
     
    6869         
    6970        cout << "======= EMix ======== " << endl; 
    70         emix eMix(rv); 
     71        emix eMix(x); 
    7172        Array<epdf*> Coms(2); 
    7273        Coms(0) = &eG; 
     
    7980 
    8081        cout << "======= MEpdf ======== " << endl; 
    81         mepdf meMix(rv,rv,&eMix); 
     82        mepdf meMix(eMix); 
    8283         
    8384        Smp = meMix.samplecond(mu0,lik,N); 
     
    8586 
    8687        cout << "======= MMix ======== " << endl; 
    87         mmix mMix(rv,rv); 
     88        mmix mMix(x,x); 
    8889        Array<mpdf*> mComs(2); 
    8990        mComs(0) = &mG; 
    9091        eN.set_mu(vec_2(0.0,0.0)); 
    91         mepdf mEnorm(rv,rv,&eN); 
     92        mepdf mEnorm(eN); 
    9293        mComs(1) = &mEnorm; 
    9394        mMix.set_parameters(vec_2(0.5,0.5),mComs); 
     
    9697        disp(mMix._epdf().mean(),zeros(2),Smp); 
    9798 
     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         
    98114        //Exit program: 
    99115        return 0;