Changeset 1189 for library/tests

Show
Ignore:
Timestamp:
09/16/10 13:22:11 (14 years ago)
Author:
smidl
Message:

new tests of egiw

Location:
library/tests
Files:
1 added
5 modified

Legend:

Unmodified
Added
Removed
  • library/tests/epdf_harness.cpp

    r1064 r1189  
    2828    UI::get ( variance, set, "variance", UI::compulsory ); 
    2929 
    30     support = UI::build<rectangular_support> ( set, "support", UI::optional ); 
     30    support = UI::build<support_base> ( set, "support", UI::optional ); 
    3131    UI::get ( nsamples, set, "nsamples", UI::optional ); 
    3232    UI::get ( R, set, "R", UI::optional ); 
     
    4545    if ( support ) { // support is given 
    4646        grid_fnc ep_disc; 
    47         ep_disc.set_support ( *support ); 
     47        ep_disc.set_support ( support ); 
    4848        ep_disc.set_values ( *hepdf ); 
    4949        // ep_disc is discretized at support points 
    5050 
    51         double point_volume = prod ( support->_steps() ); 
    52         CHECK_CLOSE ( 1.0, sum ( ep_disc._values() ) *point_volume, 0.01 ); 
     51        CHECK_CLOSE ( 1.0,  ep_disc.integrate(), 0.01 ); 
    5352 
    5453        vec pdf = ep_disc._values(); 
  • library/tests/epdf_harness.h

    r1064 r1189  
    2929    vec mean; 
    3030    vec variance; 
    31     shared_ptr<rectangular_support> support; 
     31    shared_ptr<support_base> support; 
    3232    int nsamples; 
    3333    mat R; 
  • library/tests/testsuite/egiw.cfg

    r1080 r1189  
    55    class = "egiw"; 
    66    fV = ( "matrix", 2, 2, [ 13.1, 11.0, 11.0, 10.0 ] ); 
     7// m=1.1; var_e = 0.1; 
    78    nu = 10.0; 
    89    dimx = 1; 
     
    2829    class = "egiw"; 
    2930    fV = ( "matrix", 2, 2, [ 200.0, 80.0, 80.0, 40.0 ] ); 
     31        // m=2; var_e = 1; 
    3032    nu = 40.0; 
    3133    dimx = 1; 
     
    4547        }; 
    4648  tolerance = 0.01; 
    47 }); 
    48  
    49  
    50 broken =  
     49}, 
    5150{ 
    5251  class = "epdf_harness"; 
    5352  epdf = { 
    5453    class = "egiw"; 
    55     V = ( "matrix", 2, 2, [ 10.0, 5.0, 5.0, 15.0 ] ); 
    56     nu = 10.0; 
     54    fV = ( "matrix", 2, 2, [ 10.0, 5.0, 5.0, 15.0 ] ); 
     55    nu = 16.0; 
    5756    dimx = 2; 
    5857    rv :  
     
    6261    }; 
    6362  }; 
    64   mean = [1.0, 0.5, 0.5, 1.5]; 
    65   variance = [1.0, 1.0]; 
    66   R = ( "matrix", 2, 2, [ 1.0, 0.0, 0.0, 1.0 ] ); 
     63  mean = [1.0, 0.5, 0.5, 1.5];// V/(delta-2-1)=V/(nu-2-1-2-1) 
     64  variance = [0.2500, 0.2045, 0.2045, 0.5625]; // m=13; var(i,j)=(12Vij^2+10Vii*Vjj)/(11*100*8) 
     65  R = ("matrix",4,4,[0.2500, 0.0, 0.0, 0.0, 0.0, 0.2045, 0.0, 0.0, 0.0, 0.0, 0.2045, 0.0, 0.0, 0.0, 0.0, 0.5625]);  
    6766  support = { 
    68         class = "rectangular_support"; 
    69         ranges = ( [ 0.0, 4.0 ], [-2.0, 2.0], [-2.0, 2.0], [0.0, 4.0 ] ); 
    70         gridsizes = [ 10, 10, 10, 10]; 
     67        class = "discrete_support"; 
     68        points = "s@egiw_support.cfg"; 
     69        volumes = "v@egiw_support.cfg"; 
    7170        }; 
    72   tolerance = 0.01; 
    73 }; 
     71  tolerance = 0.03; 
     72} 
     73); 
  • library/tests/testsuite/epdf_test.cpp

    r1064 r1189  
    5353    mat wM = "1.1 0.9; 0.9 1.0"; 
    5454    eWishartCh eW; 
    55     eW.set_parameters ( wM / 100, 100 ); 
     55    eW.set_parameters ( wM , 10 ); 
    5656    eW.validate(); 
    5757    mat mea = zeros ( 2, 2 ); 
    58     mat Ch; 
     58    chmat Ch; 
    5959    for ( int i = 0; i < 100; i++ ) { 
    6060        Ch = eW.sample_mat(); 
    61         mea += Ch.T() * Ch; 
     61        mea += Ch.to_mat(); 
    6262    } 
    6363 
    6464    mat actual = mea / 100; 
    65     CHECK_CLOSE ( wM, actual, 0.1 ); 
     65    CHECK_CLOSE ( 10*wM, actual, 0.3 ); 
    6666} 
    6767 
  • library/tests/testsuite/rectangular_support_test.cpp

    r1064 r1189  
    99TEST ( rectangular_support_test ) { 
    1010    rectangular_support rs; 
    11     CHECK_EQUAL ( rs.first_vec(), vec ( 0 ) ); 
     11    //CHECK_EQUAL ( rs.first_vec(), vec ( 0 ) ); 
    1212 
    1313    Array<vec> range ( 2 );