Changeset 162 for tests

Show
Ignore:
Timestamp:
09/04/08 20:27:01 (16 years ago)
Author:
smidl
Message:

opravy a dokumentace

Location:
tests
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • tests/CMakeLists.txt

    r145 r162  
    3838target_link_libraries (rv_test ${BdmLibs}) 
    3939 
     40add_executable (merger_test merger_test.cpp) 
     41target_link_libraries (merger_test ${BdmLibs}) 
     42 
    4043add_executable (test0 test0.cpp) 
    4144add_executable (testKF testKF.cpp) 
  • tests/arx_test.cpp

    r100 r162  
    1717        double nu0 = ord+1; 
    1818         
    19         RV thr("1","{theta_and_r }",vec_1(th.length()+1),"0"); 
     19        RV thr("{theta_and_r }"); 
    2020        ARX Ar(thr, V0, nu0); 
    2121        epdf& Ar_ep = Ar._epdf(); 
  • tests/loggers_test.cpp

    r89 r162  
    1212        int i; 
    1313         
    14         RV th = RV ( "1 2","{a b }","1 1","0 0"); 
    15         RV r = RV ( "2","{r }","2","0" ); 
     14        RV th = RV ( "{a b }"); 
     15        RV r = RV ( "{r }","2"); 
    1616 
    1717        dirfilelog L("exp/dirfile",10); 
     
    3030                L.step(); 
    3131        } 
    32         L.step(true); 
     32        L.finalize(); 
    3333} 
  • tests/rv_test.cpp

    r147 r162  
    1212int main() 
    1313{ 
    14         RV a = RV ( "1","{a }","3","0"); 
    15         RV b = RV ( "2","{b }","2","0"); 
    16         RV c = RV ( "3","{c }","1","0"); 
    17         RV ef = RV ( "4 5","{e f }", " 1 1", "0 0" ); 
     14        RV a = RV ( "{a }","3"); 
     15        RV b = RV ( "{b }","2"); 
     16        RV c = RV ( "{c }"); 
     17        RV ef = RV ("{e f }"); 
    1818         
    1919        cout << "Add a and b"<<endl; 
  • tests/test0.cpp

    r101 r162  
    1212int main() 
    1313{ 
    14         RV th = RV ( "1 2","{a b }","1 1","0 0"); 
    15         RV r = RV ( "3 4" ); 
     14        RV th = RV ( "{a b }"); 
     15        RV r = RV ( "{r1 r2 }" ); 
    1616 
    1717        cout << th << r << endl; 
    1818 
    19         ldmat ld = ldmat("1 0;0.5 1","1.1 1.3"); 
    20         vec v = "1 -0.1"; 
     19        ldmat ld = ldmat("1 0 0 0; 0.2 1 0 0; 0.1 -0.1 1 0; -0.9 0.3 -0.1 1", 
     20                                         "3 4 5 6"); 
     21        vec v = "1 -1 3 -1"; 
    2122         
    2223        cout << "Test to_mat"<<endl; 
    2324//      cout << ld << endl; 
    24         cout << ld.to_mat()<<endl; 
     25        mat L = ld.to_mat(); 
     26        cout << L <<endl; 
    2527 
    2628        cout << "Test opupdt" <<endl; 
     29        cout << "w=1" <<endl; 
    2730        ldmat ldup = ld; 
    2831        ldup.opupdt(v,1); 
    2932        cout << ldup.to_mat()<<endl; 
     33        cout << L + outer_product(v,v) <<endl; 
     34        ldup = ld;       
     35        cout << "w=0.1" <<endl; 
     36        ldup.opupdt(v,0.1); 
     37        cout << ldup.to_mat()<<endl; 
     38        cout << L + 0.1*outer_product(v,v) <<endl; 
    3039 
    3140        cout << "Test +="<<endl; 
    3241        ldmat ld2x = ld; 
    3342        ld2x+=ld; 
    34         cout << ld.to_mat() << ld2x.to_mat() <<endl; 
     43        cout << ld.to_mat() <<endl << ld2x.to_mat() <<endl; 
    3544 
     45        cout << "Test *="<<endl; 
     46        ld2x = ld; 
     47        ld2x*=2; 
     48        cout << ld.to_mat() <<endl << ld2x.to_mat() <<endl; 
     49         
    3650        cout << "Test ldinv()"<<endl; 
    3751        ldmat Il = ld;  
  • tests/testEpdf.cpp

    r32 r162  
    1414        vec y = "-10:0.1:10"; 
    1515 
    16         RV rv ( "1","{x }","2","0" ); 
     16        RV rv ( "{x }","2" ); 
    1717        vec mu0 = "0.0 0.0"; 
    1818        mat V0 ( "5 -0.05; -0.05 5.20" ); 
  • tests/testKF.cpp

    r100 r162  
    4141         
    4242        // Prepare for Kalman filters in BDM: 
    43         ivec tmpsize(1); 
    44         tmpsize(0) = A.cols(); 
    45         RV rx("1","{x }",tmpsize,"0"); 
    46         tmpsize(0) = B.cols(); 
    47         RV ru("2","{u }",tmpsize,"0"); 
    48         tmpsize(0) = C.rows(); 
    49         RV ry("3","{y }",tmpsize,"0"); 
     43        RV rx("{x }",vec_1(A.cols())); 
     44        RV ru("{u }",vec_1(B.cols())); 
     45        RV ry("{y }",vec_1(C.rows())); 
    5046         
    5147//      // LDMAT 
  • tests/testKF_QR.cpp

    r33 r162  
    4343 
    4444//      cout << KF; 
    45         RV rx("1","{x}","2","0"); 
    46         RV ru("2","{u}","1","0"); 
    47         RV ry("3","{y}","1","0"); 
    48         RV rQR("4","{Q,R}","3","0"); 
     45        RV rx("{x }","2"); 
     46        RV ru("{u }","1"); 
     47        RV ry("{y }","1"); 
     48        RV rQR("{Q,R }","3"); 
    4949        // 
    5050        KFcondQR KF(rx,ry,ru,rQR); 
  • tests/testKF_QRexh.cpp

    r33 r162  
    4848        Ndat = Dt.cols(); 
    4949 
    50         RV rx ( "1","{x}","2","0" ); 
    51         RV ru ( "2","{u}","1","0" ); 
    52         RV ry ( "3","{y}","2","0" ); 
     50        RV rx ( "{x}","2" ); 
     51        RV ru ( "{u}","1" ); 
     52        RV ry ( "{y}","2" ); 
    5353        // 
    5454        // 
  • tests/testSmp.cpp

    r145 r162  
    2424        RNG_randomize(); 
    2525 
    26         RV x("1","{x }","2","0"); 
    27         RV y("2","{y }","2","0"); 
     26        RV x("{x }","2"); 
     27        RV y("{y }","2"); 
    2828        int N = 10000; //number of samples 
    2929        vec mu0 = "1.5 1.7"; 
     
    101101        eG._rv()= y;  
    102102        //create array  
    103         Array<epdf*> A(2); 
    104         A(0) = &eN; 
    105         A(1) = &eG; 
     103        Array<mpdf*> A(2); 
     104        mepdf meN(eN); 
     105        mepdf meG(eG); 
     106        A(0) = &meN; 
     107        A(1) = &meG; 
    106108         
    107         eprod eP(A); 
     109        mprod eP(A); 
    108110        mat epV=zeros(4,4); 
    109111        epV.set_submatrix(0,0,V0); 
    110112        epV.set_submatrix(2,2,diag(g_var)); 
    111         Smp = eP.sampleN(N); 
    112         disp(eP.mean(), epV,Smp); 
     113         
     114        vec v0=vec(0); 
     115        Smp = eP.samplecond(v0,lik,N); 
     116        disp(concat(eN.mean(),eG.mean()), epV,Smp); 
    113117         
    114118        //Exit program: