- Timestamp:
- 09/04/08 20:27:01 (16 years ago)
- Location:
- tests
- Files:
-
- 10 modified
Legend:
- Unmodified
- Added
- Removed
-
tests/CMakeLists.txt
r145 r162 38 38 target_link_libraries (rv_test ${BdmLibs}) 39 39 40 add_executable (merger_test merger_test.cpp) 41 target_link_libraries (merger_test ${BdmLibs}) 42 40 43 add_executable (test0 test0.cpp) 41 44 add_executable (testKF testKF.cpp) -
tests/arx_test.cpp
r100 r162 17 17 double nu0 = ord+1; 18 18 19 RV thr(" 1","{theta_and_r }",vec_1(th.length()+1),"0");19 RV thr("{theta_and_r }"); 20 20 ARX Ar(thr, V0, nu0); 21 21 epdf& Ar_ep = Ar._epdf(); -
tests/loggers_test.cpp
r89 r162 12 12 int i; 13 13 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"); 16 16 17 17 dirfilelog L("exp/dirfile",10); … … 30 30 L.step(); 31 31 } 32 L. step(true);32 L.finalize(); 33 33 } -
tests/rv_test.cpp
r147 r162 12 12 int main() 13 13 { 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 }"); 18 18 19 19 cout << "Add a and b"<<endl; -
tests/test0.cpp
r101 r162 12 12 int main() 13 13 { 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 }" ); 16 16 17 17 cout << th << r << endl; 18 18 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"; 21 22 22 23 cout << "Test to_mat"<<endl; 23 24 // cout << ld << endl; 24 cout << ld.to_mat()<<endl; 25 mat L = ld.to_mat(); 26 cout << L <<endl; 25 27 26 28 cout << "Test opupdt" <<endl; 29 cout << "w=1" <<endl; 27 30 ldmat ldup = ld; 28 31 ldup.opupdt(v,1); 29 32 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; 30 39 31 40 cout << "Test +="<<endl; 32 41 ldmat ld2x = ld; 33 42 ld2x+=ld; 34 cout << ld.to_mat() << ld2x.to_mat() <<endl;43 cout << ld.to_mat() <<endl << ld2x.to_mat() <<endl; 35 44 45 cout << "Test *="<<endl; 46 ld2x = ld; 47 ld2x*=2; 48 cout << ld.to_mat() <<endl << ld2x.to_mat() <<endl; 49 36 50 cout << "Test ldinv()"<<endl; 37 51 ldmat Il = ld; -
tests/testEpdf.cpp
r32 r162 14 14 vec y = "-10:0.1:10"; 15 15 16 RV rv ( " 1","{x }","2","0" );16 RV rv ( "{x }","2" ); 17 17 vec mu0 = "0.0 0.0"; 18 18 mat V0 ( "5 -0.05; -0.05 5.20" ); -
tests/testKF.cpp
r100 r162 41 41 42 42 // 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())); 50 46 51 47 // // LDMAT -
tests/testKF_QR.cpp
r33 r162 43 43 44 44 // 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"); 49 49 // 50 50 KFcondQR KF(rx,ry,ru,rQR); -
tests/testKF_QRexh.cpp
r33 r162 48 48 Ndat = Dt.cols(); 49 49 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" ); 53 53 // 54 54 // -
tests/testSmp.cpp
r145 r162 24 24 RNG_randomize(); 25 25 26 RV x(" 1","{x }","2","0");27 RV y(" 2","{y }","2","0");26 RV x("{x }","2"); 27 RV y("{y }","2"); 28 28 int N = 10000; //number of samples 29 29 vec mu0 = "1.5 1.7"; … … 101 101 eG._rv()= y; 102 102 //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; 106 108 107 eprod eP(A);109 mprod eP(A); 108 110 mat epV=zeros(4,4); 109 111 epV.set_submatrix(0,0,V0); 110 112 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); 113 117 114 118 //Exit program: