Changeset 442 for library

Show
Ignore:
Timestamp:
07/29/09 08:49:20 (15 years ago)
Author:
vbarta
Message:

distinguishing nbins from nsamples

Location:
library/tests
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • library/tests/egiw.cfg

    r441 r442  
    1616  variance = [ 0.002, 8e-05 ]; 
    1717  support = ( "matrix", 2, 2, [ -2.0, 4.0, 0.01, 2.0 ] ); 
    18   nsamples = 200; 
     18  nbins = [ 100, 200 ]; 
    1919  integral = 1.0; 
    2020}, 
  • library/tests/epdf_harness.cpp

    r441 r442  
    4949    } 
    5050 
     51    if (set.exists("nbins")) { 
     52        UI::get(nbins, set, "nbins"); 
     53    } 
     54 
    5155    if (set.exists("nsamples")) { 
    5256        UI::get(nsamples, set, "nsamples"); 
     
    7074        vec xb = support.get_row(0); 
    7175        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); 
    7489    } 
    7590 
    7691    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); 
    8196        CHECK_CLOSE(mean, Emu, 0.1); 
    8297        CHECK_CLOSE(R, Er, 0.1); 
  • library/tests/epdf_harness.h

    r441 r442  
    3232    vec variance; 
    3333    mat support; 
     34    vec nbins; 
    3435    int nsamples; 
    3536    double integral; 
     
    3738 
    3839public: 
    39     epdf_harness():nsamples(100), integral(0) { } 
     40    epdf_harness():nsamples(1000), integral(0) { } 
    4041 
    4142    virtual void test();