Changeset 1189 for library/tests
- Timestamp:
- 09/16/10 13:22:11 (14 years ago)
- Location:
- library/tests
- Files:
-
- 1 added
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/epdf_harness.cpp
r1064 r1189 28 28 UI::get ( variance, set, "variance", UI::compulsory ); 29 29 30 support = UI::build< rectangular_support> ( set, "support", UI::optional );30 support = UI::build<support_base> ( set, "support", UI::optional ); 31 31 UI::get ( nsamples, set, "nsamples", UI::optional ); 32 32 UI::get ( R, set, "R", UI::optional ); … … 45 45 if ( support ) { // support is given 46 46 grid_fnc ep_disc; 47 ep_disc.set_support ( *support );47 ep_disc.set_support ( support ); 48 48 ep_disc.set_values ( *hepdf ); 49 49 // ep_disc is discretized at support points 50 50 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 ); 53 52 54 53 vec pdf = ep_disc._values(); -
library/tests/epdf_harness.h
r1064 r1189 29 29 vec mean; 30 30 vec variance; 31 shared_ptr< rectangular_support> support;31 shared_ptr<support_base> support; 32 32 int nsamples; 33 33 mat R; -
library/tests/testsuite/egiw.cfg
r1080 r1189 5 5 class = "egiw"; 6 6 fV = ( "matrix", 2, 2, [ 13.1, 11.0, 11.0, 10.0 ] ); 7 // m=1.1; var_e = 0.1; 7 8 nu = 10.0; 8 9 dimx = 1; … … 28 29 class = "egiw"; 29 30 fV = ( "matrix", 2, 2, [ 200.0, 80.0, 80.0, 40.0 ] ); 31 // m=2; var_e = 1; 30 32 nu = 40.0; 31 33 dimx = 1; … … 45 47 }; 46 48 tolerance = 0.01; 47 }); 48 49 50 broken = 49 }, 51 50 { 52 51 class = "epdf_harness"; 53 52 epdf = { 54 53 class = "egiw"; 55 V = ( "matrix", 2, 2, [ 10.0, 5.0, 5.0, 15.0 ] );56 nu = 1 0.0;54 fV = ( "matrix", 2, 2, [ 10.0, 5.0, 5.0, 15.0 ] ); 55 nu = 16.0; 57 56 dimx = 2; 58 57 rv : … … 62 61 }; 63 62 }; 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]); 67 66 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"; 71 70 }; 72 tolerance = 0.01; 73 }; 71 tolerance = 0.03; 72 } 73 ); -
library/tests/testsuite/epdf_test.cpp
r1064 r1189 53 53 mat wM = "1.1 0.9; 0.9 1.0"; 54 54 eWishartCh eW; 55 eW.set_parameters ( wM / 100, 100 );55 eW.set_parameters ( wM , 10 ); 56 56 eW.validate(); 57 57 mat mea = zeros ( 2, 2 ); 58 mat Ch;58 chmat Ch; 59 59 for ( int i = 0; i < 100; i++ ) { 60 60 Ch = eW.sample_mat(); 61 mea += Ch. T() * Ch;61 mea += Ch.to_mat(); 62 62 } 63 63 64 64 mat actual = mea / 100; 65 CHECK_CLOSE ( wM, actual, 0.1);65 CHECK_CLOSE ( 10*wM, actual, 0.3 ); 66 66 } 67 67 -
library/tests/testsuite/rectangular_support_test.cpp
r1064 r1189 9 9 TEST ( rectangular_support_test ) { 10 10 rectangular_support rs; 11 CHECK_EQUAL ( rs.first_vec(), vec ( 0 ) );11 //CHECK_EQUAL ( rs.first_vec(), vec ( 0 ) ); 12 12 13 13 Array<vec> range ( 2 );