- Timestamp:
- 07/29/09 08:49:20 (15 years ago)
- Location:
- library/tests
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/egiw.cfg
r441 r442 16 16 variance = [ 0.002, 8e-05 ]; 17 17 support = ( "matrix", 2, 2, [ -2.0, 4.0, 0.01, 2.0 ] ); 18 n samples = 200;18 nbins = [ 100, 200 ]; 19 19 integral = 1.0; 20 20 }, -
library/tests/epdf_harness.cpp
r441 r442 49 49 } 50 50 51 if (set.exists("nbins")) { 52 UI::get(nbins, set, "nbins"); 53 } 54 51 55 if (set.exists("nsamples")) { 52 56 UI::get(nsamples, set, "nsamples"); … … 70 74 vec xb = support.get_row(0); 71 75 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); 76 77 int old_size = nbins.size(); 78 if (old_size < 2) { 79 vec new_nbins("100 100"); 80 for (int i = 0; i < old_size; ++i) { 81 new_nbins(i) = nbins(i); 82 } 83 84 nbins = new_nbins; 85 } 86 87 CHECK_CLOSE(mean, num_mean2(hepdf.get(), xb, yb, nbins(0), nbins(1)), 0.1); 88 CHECK_CLOSE(integral, normcoef(hepdf.get(), xb, yb, nbins(0), nbins(1)), 0.1); 74 89 } 75 90 76 91 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);92 mat smp = hepdf->sample_m(nsamples); 93 int N = smp.cols(); 94 vec Emu = smp*ones(N) /N ; 95 mat Er = (smp*smp.transpose())/N - outer_product(Emu,Emu); 81 96 CHECK_CLOSE(mean, Emu, 0.1); 82 97 CHECK_CLOSE(R, Er, 0.1); -
library/tests/epdf_harness.h
r441 r442 32 32 vec variance; 33 33 mat support; 34 vec nbins; 34 35 int nsamples; 35 36 double integral; … … 37 38 38 39 public: 39 epdf_harness():nsamples(100 ), integral(0) { }40 epdf_harness():nsamples(1000), integral(0) { } 40 41 41 42 virtual void test();