Changeset 441
- Timestamp:
- 07/29/09 08:29:35 (16 years ago)
- Location:
- library/tests
- Files:
-
- 2 added
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/CMakeLists.txt
r439 r441 38 38 39 39 # using UnitTest++ 40 add_executable(testsuite datalink_test.cpp eg iw_test.cpp enorm_test.cpp loggers_test.cpp rv_test.cpp square_mat_test.cpp testsuite.cpp test_user_info.cpp test_shared_ptr.cpp)40 add_executable(testsuite datalink_test.cpp egamma_test.cpp egiw_test.cpp enorm_test.cpp loggers_test.cpp rv_test.cpp square_mat_test.cpp testsuite.cpp test_user_info.cpp test_shared_ptr.cpp) 41 41 target_link_libraries(testsuite bdm itpp testutil unittest) 42 42 -
library/tests/egiw.cfg
r440 r441 18 18 nsamples = 200; 19 19 integral = 1.0; 20 }, 21 { 22 class = "egiw_harness"; 23 epdf = { 24 class = "egiw"; 25 V = ( "matrix", 2, 2, [ 20.0, 8.0, 8.0, 4.0 ] ); 26 nu = 4.0; 27 dimx = 1.0; 28 rv : 29 { 30 class = "RV"; 31 names = ( "a", "b" ); 32 }; 33 }; 34 mean = [ 2, -4 ]; 35 lognc = 0.451583; 36 variance = [ -1, -16 ]; 20 37 } ); 21 38 -
library/tests/epdf_harness.cpp
r439 r441 44 44 UI::get(mean, set, "mean"); 45 45 UI::get(variance, set, "variance"); 46 UI::get(support, set, "support"); 46 47 if (set.exists("support")) { 48 UI::get(support, set, "support"); 49 } 47 50 48 51 if (set.exists("nsamples")) { … … 50 53 } 51 54 52 UI::get(integral, set, "integral"); 55 if (set.exists("integral")) { 56 UI::get(integral, set, "integral"); 57 } 58 59 if (set.exists("R")) { 60 UI::get(R, set, "R"); 61 } 53 62 } 54 63 … … 58 67 CHECK_CLOSE(variance, hepdf->variance(), epsilon); 59 68 60 vec xb = support.get_row(0); 61 vec yb = support.get_row(1); 62 CHECK_CLOSE(mean, num_mean2(hepdf.get(), xb, yb, nsamples, nsamples), 0.1); 63 CHECK_CLOSE(integral, normcoef(hepdf.get(), xb, yb, nsamples, nsamples), 0.1); 69 if (support.rows() == 2) { 70 vec xb = support.get_row(0); 71 vec yb = support.get_row(1); 72 CHECK_CLOSE(mean, num_mean2(hepdf.get(), xb, yb, nsamples, nsamples), 0.1); 73 CHECK_CLOSE(integral, normcoef(hepdf.get(), xb, yb, nsamples, nsamples), 0.1); 74 } 75 76 if (R.rows() > 0) { 77 mat Smp = hepdf->sample_m(10000); 78 int N = Smp.cols(); 79 vec Emu = Smp*ones(N) /N ; 80 mat Er = (Smp*Smp.transpose())/N - outer_product(Emu,Emu); 81 CHECK_CLOSE(mean, Emu, 0.1); 82 CHECK_CLOSE(R, Er, 0.1); 83 } 64 84 } 65 85 -
library/tests/epdf_harness.h
r439 r441 34 34 int nsamples; 35 35 double integral; 36 mat R; 36 37 37 38 public: