Changeset 448 for library/tests
- Timestamp:
- 07/29/09 13:26:40 (15 years ago)
- Location:
- library/tests
- Files:
-
- 2 added
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/CMakeLists.txt
r447 r448 38 38 39 39 # using UnitTest++ 40 add_executable(testsuite datalink_test.cpp egamma_test.cpp egiw_test.cpp enorm_test.cpp loggers_test.cpp m gamma_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 mepdf_test.cpp mgamma_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/enorm_test.cpp
r445 r448 1 1 #define BDMLIB // not an ideal way to prevent double registration of UI factories... 2 2 #include "stat/exp_family.h" 3 #include "stat/emix.h"4 3 #include "epdf_harness.h" 5 4 #include "mat_checks.h" … … 72 71 E.set_parameters(mu, R); 73 72 74 int N= 1000;75 vec ll( N);76 mat Smp = E.sample(1000);77 vec Emu = sum(Smp, 2) / N;78 CHECK_CLOSE(mu, Emu, 0.3);73 int n = 1000; 74 vec ll(n); 75 mat smp = E.sample(1000); 76 vec emu = sum(smp, 2) / n; 77 CHECK_CLOSE(mu, emu, 0.3); 79 78 80 mat Er = (Smp * Smp.T()) / N - outer_product(Emu, Emu); 81 CHECK_CLOSE(R.to_mat(), Er, 0.3); 82 83 epdf *Mg = E.marginal(y); 84 CHECK_CLOSE(vec("-1"), Mg->mean(), epsilon); 85 86 // putting them back together 87 mpdf *Cn = E.condition(x); 88 mepdf mMg(Mg); 89 Array<mpdf *> A(2); 90 A(0) = Cn; 91 A(1) = &mMg; 92 mprod mEp(A); 93 Smp = mEp.samplecond(vec(0), 1000); 94 Emu = sum(Smp, 2) / N; 95 CHECK_CLOSE(mu, Emu, 0.3); 96 97 Er = (Smp * Smp.T()) / N - outer_product(Emu, Emu); 98 CHECK_CLOSE(R.to_mat(), Er, 0.3); 99 100 // test of pdflog at zero 101 vec zero(0); 102 vec zero2("0 0"); 103 CHECK_CLOSE(E.evallog(zero2), mEp.evallogcond(zero2, zero), epsilon); 79 mat er = (smp * smp.T()) / n - outer_product(emu, emu); 80 CHECK_CLOSE(R.to_mat(), er, 0.3); 104 81 }