Changeset 722 for library/tests/stresssuite
- Timestamp:
- 11/13/09 16:11:31 (15 years ago)
- Location:
- library/tests/stresssuite
- Files:
-
- 9 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/stresssuite/arx_elem_stress.cpp
r721 r722 11 11 ARX Ar; 12 12 Ar.set_statistics ( 1, V0, -1.0 ); 13 Ar.set_constant (true);13 Ar.set_constant ( true ); 14 14 Ar.validate(); 15 15 -
library/tests/stresssuite/arx_stress.cpp
r721 r722 29 29 ARX Ar; 30 30 Ar.set_statistics ( 1, V0, nu0 ); // Estimator 31 Ar.set_constant (false);31 Ar.set_constant ( false ); 32 32 Ar.validate(); 33 33 const epdf& f_thr = Ar.posterior(); // refrence to posterior of the estimator … … 52 52 Yt ( t ) = th * rgr + sqr * NorRNG(); 53 53 54 Ar.bayes ( vec_1 (Yt(t)), rgr );// Bayes rule54 Ar.bayes ( vec_1 ( Yt ( t ) ), rgr ); // Bayes rule 55 55 56 56 // Build predictor -
library/tests/stresssuite/kalman_QR_stress.cpp
r721 r722 70 70 KF_QR.set_parameters ( &evolQR, &evolQR, 100 ); 71 71 evolQR.condition ( "1 1 1" ); 72 egamma kfinit =egamma("10 10 10","1 1 1");73 KF_QR.set_statistics ( egamma ("10 10 10","1 1 1"), &KF );72 egamma kfinit = egamma ( "10 10 10", "1 1 1" ); 73 KF_QR.set_statistics ( egamma ( "10 10 10", "1 1 1" ), &KF ); 74 74 const epdf& mpost = KF_QR.posterior(); 75 75 const epdf& mposttr = KFtr.posterior(); -
library/tests/stresssuite/kalman_stress.cpp
r721 r722 63 63 KF.set_parameters ( A, B, C, D, chmat ( Q ), chmat ( R ) ); 64 64 KF.set_statistics ( mu0, chmat ( P0 ) ); //prediction! 65 KF.set_evalll (false);65 KF.set_evalll ( false ); 66 66 KF.validate(); 67 67 const epdf& KFep = KF.posterior(); … … 71 71 // FULL 72 72 KalmanFull KF2; 73 KF2.set_parameters ( A, B, C, D, Q, R);74 KF2.set_statistics (mu0, P0 );75 KF2.set_evalll (false);73 KF2.set_parameters ( A, B, C, D, Q, R ); 74 KF2.set_statistics ( mu0, P0 ); 75 KF2.set_evalll ( false ); 76 76 KF2.validate(); 77 77 mat Xt2 ( dimx, Ndat ); … … 85 85 KFE.set_parameters ( fxu, hxu, Q, R ); 86 86 KFE.set_statistics ( mu0, chmat ( P0 ) ); 87 KFE.set_evalll (false);87 KFE.set_evalll ( false ); 88 88 KFE.validate(); 89 89 const epdf& KFEep = KFE.posterior(); … … 98 98 tt.tic(); 99 99 for ( int t = 1; t < Ndat; t++ ) { 100 dt = Dt.get_col (t);101 KF.bayes ( dt.get (0,C.rows()-1), dt.get(C.rows(), dt.length()-1) );100 dt = Dt.get_col ( t ); 101 KF.bayes ( dt.get ( 0, C.rows() - 1 ), dt.get ( C.rows(), dt.length() - 1 ) ); 102 102 Xt.set_col ( t, KFep.mean() ); 103 103 } … … 106 106 tt.tic(); 107 107 for ( int t = 1; t < Ndat; t++ ) { 108 dt = Dt.get_col (t);109 KF2.bayes ( dt.get (0,C.rows()-1), dt.get(C.rows(), dt.length()-1) );108 dt = Dt.get_col ( t ); 109 KF2.bayes ( dt.get ( 0, C.rows() - 1 ), dt.get ( C.rows(), dt.length() - 1 ) ); 110 110 Xt2.set_col ( t, KF2.posterior().mean() ); 111 111 } … … 114 114 tt.tic(); 115 115 for ( int t = 1; t < Ndat; t++ ) { 116 dt = Dt.get_col (t);117 KFE.bayes ( dt.get (0,C.rows()-1), dt.get(C.rows(), dt.length()-1) );116 dt = Dt.get_col ( t ); 117 KFE.bayes ( dt.get ( 0, C.rows() - 1 ), dt.get ( C.rows(), dt.length() - 1 ) ); 118 118 XtE.set_col ( t, KFEep.mean() ); 119 119 } -
library/tests/stresssuite/mixtures_stress.cpp
r721 r722 101 101 // Add ones for constant coefficients 102 102 mat Data = concat_vertical ( Smp, ones ( 1, Smp.cols() ) ); 103 Post.bayes ( Data , empty_vec );103 Post.bayes ( Data , empty_vec ); 104 104 105 105 cout << "Posterior mixture:" << endl; -
library/tests/stresssuite/particle_stress.cpp
r721 r722 37 37 38 38 ivec ind; 39 emp.resample (ind);39 emp.resample ( ind ); 40 40 41 41 cout << ind << endl; -
library/tests/stresssuite/resample_stress.cpp
r721 r722 38 38 39 39 ivec ind; 40 emp.resample (ind);40 emp.resample ( ind ); 41 41 42 42 cout << ind << endl; -
library/tests/stresssuite/size_generator.cpp
r717 r722 5 5 using bdm::UI; 6 6 7 void size_generator::from_setting (const Setting &set) {8 UI::get ( sz, set, "size", UI::optional );9 UI::get ( step, set, "step", UI::optional );7 void size_generator::from_setting ( const Setting &set ) { 8 UI::get ( sz, set, "size", UI::optional ); 9 UI::get ( step, set, "step", UI::optional ); 10 10 } 11 11 -
library/tests/stresssuite/stresssuite.cpp
r721 r722 5 5 #include "itpp_ext.h" 6 6 #include <string.h> 7 #include "../general_suite.h" 7 8 8 using std::cout; 9 using std::cerr; 10 using std::endl; 11 12 using namespace itpp; 13 14 Array<const char *> selected_tests; 15 16 bool is_selected_test ( const UnitTest::Test *test ) { 17 bdm_assert_debug ( test, "NULL test" ); 18 19 if ( !selected_tests.length() ) { 20 return true; 21 } 22 23 for ( int i = 0; i < selected_tests.length(); ++i ) { 24 const char *n = test->m_details.testName; 25 bdm_assert_debug ( n, "NULL test name" ); 26 const char *sname = selected_tests ( i ); 27 bdm_assert_debug ( sname, "NULL selected test name" ); 28 if ( !strcmp ( n, sname ) ) { 29 return true; 30 } 31 } 32 33 return false; 34 } 9 using namespace UnitTest; 35 10 36 11 int main ( int argc, char const *argv[] ) { 37 12 if ( argc > 1 ) { 38 if ( !strcmp ( argv[1], "print" ) ) { 39 UnitTest::Test* curTest = UnitTest::Test::GetTestList().GetHead(); 40 41 while ( curTest != 0 ) { 42 const char *n = curTest->m_details.testName; 43 printf ( "%s\n", n ); 44 curTest = curTest->next; 45 } 46 return 0; 47 } else { 48 selected_tests.set_length ( argc - 1 ); 49 const char **param = argv + 1; 50 int i = 0; 51 while ( *param ) { 52 selected_tests ( i ) = *param; 53 ++i; 54 ++param; 55 } 56 } 13 if ( !strcmp ( argv[1], "print" ) ) 14 print_test_list(); 15 else 16 pick_selected_tests ( argc, argv ); 57 17 } else { 58 cout << endl << "STRESSSUITE - a program covering all BDM stress tests." << endl << endl 59 << argv[0] << " ....................................... run all stress tests" << endl 60 << argv[0] << " particular_test_1 particular_test_2 ... run selected stress tests" << endl 18 cout << endl << "STRESSSUITE - a program covering all BDM stress tests." << endl << endl 19 << argv[0] << " ....................................... run all stress tests" << endl 20 << argv[0] << " particular_test_1 particular_test_2 ... run selected stress tests" << endl 61 21 << argv[0] << " print ................................. print all the implemented stress tests" << endl; 62 22 } 63 23 64 itpp::RNG_randomize(); 65 66 UnitTest::TestReporterStdout reporter; 67 UnitTest::TestRunner runner ( reporter ); 68 return runner.RunTestsIf ( UnitTest::Test::GetTestList(), 69 0, 70 is_selected_test, 71 0 ); 24 return run_selected_tests(); 72 25 }