# $Id: t_distr_corder.conf 5330 2011-04-19 10:50:18Z leydold $ ############################################################################# [main] [main - data:] # method (for information only: the program scans the file name) method: DISTR_CORDER [main - header:] /* prototypes */ \#define COMPARE_SAMPLE_SIZE (500) \#define VIOLATE_SAMPLE_SIZE (20) ############################################################################# [new] [new - invalid NULL ptr: distr = NULL; ] unur_distr_corder_new( distr, 5, 2 ); --> expected_NULL --> UNUR_ERR_NULL [new - invalid distribution type: distr = unur_distr_discr_new(); ] unur_distr_corder_new( distr, 5, 2 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID [new - invalid order statistics: UNUR_DISTR *os; distr = unur_distr_normal(NULL,0); os = unur_distr_corder_new( distr, 5, 2 ); ] unur_distr_corder_new( os, 5, 2 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_free(os); [new - invalid data: distr = unur_distr_normal(NULL,0); ] unur_distr_corder_new( distr, 5, 6 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_corder_new( distr, 1, 1 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_corder_new( distr, 2, 0 ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID ############################################################################# [set] [set - invalid NULL ptr: distr = NULL; ] unur_distr_corder_set_rank( distr, 5, 2 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_corder_set_pdfparams( distr, NULL, 0 ) --> expected_setfailed --> UNUR_ERR_NULL unur_distr_corder_set_domain( distr, 0., 1. ) --> expected_setfailed --> UNUR_ERR_NULL unur_distr_corder_set_mode( distr, 0. ) --> expected_setfailed --> UNUR_ERR_NULL unur_distr_corder_set_pdfarea( distr, 1. ) --> expected_setfailed --> UNUR_ERR_NULL [set - invalid distribution object: distr = unur_distr_normal(NULL,0); ] unur_distr_corder_set_rank( distr, 5, 2 ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid distribution object: distr = unur_distr_discr_new(); ] unur_distr_corder_set_pdfparams( distr, NULL, 0 ) --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_corder_set_domain( distr, 0., 1. ) --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_corder_set_mode( distr, 0. ) --> expected_setfailed --> UNUR_ERR_DISTR_INVALID unur_distr_corder_set_pdfarea( distr, 1. ) --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [set - invalid NULL ptr: UNUR_DISTR *os; distr = unur_distr_normal(NULL,0); os = unur_distr_corder_new( distr, 5, 2 ); ] unur_distr_corder_set_pdfparams( distr, NULL, 1 ); --> expected_setfailed --> UNUR_ERR_NULL unur_distr_free(os); [set - invalid parameters: UNUR_DISTR *os; distr = unur_distr_normal(NULL,0); os = unur_distr_corder_new( distr, 5, 2 ); ] unur_distr_corder_set_rank( os, 5, 20 ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_cont_set_pdfarea( distr, -1. ); --> expected_setfailed --> UNUR_ERR_DISTR_SET unur_distr_free(os); ############################################################################# [get] [get - invalid NULL ptr: int n, k; distr = NULL; ] unur_distr_corder_get_distribution( distr ); --> expected_NULL --> UNUR_ERR_NULL unur_distr_corder_get_rank( distr, &n, &k ); --> expected_setfailed --> UNUR_ERR_NULL [get - invalid distribution type: int n, k; distr = unur_distr_discr_new(); ] unur_distr_corder_get_distribution( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_corder_get_rank( distr, &n, &k ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID [get - parameters not unknown: int n, k; distr = unur_distr_cont_new(); ] unur_distr_corder_get_distribution( distr ); --> expected_NULL --> UNUR_ERR_DISTR_INVALID unur_distr_corder_get_rank( distr, &n, &k ); --> expected_setfailed --> UNUR_ERR_DISTR_INVALID ############################################################################# # [chg] ############################################################################# # [init] ############################################################################# # [reinit] ############################################################################# [sample] [sample - compare clone: UNUR_GEN *clone; UNUR_DISTR *d; d = unur_distr_cauchy(NULL,0); distr = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); par = unur_arou_new(distr); unur_arou_set_max_sqhratio(par,0.); gen = unur_init( par ); <-- ! NULL ] /* original generator object */ -->compare_sequence_gen_start /* clone */ clone = unur_gen_clone(gen); unur_free(gen); gen = clone; -->compare_sequence_gen #..................................................................... [sample - compare stringparser: UNUR_DISTR *os = NULL; distr = NULL; par = NULL; gen = NULL; ] distr = unur_distr_normal(NULL,0); unur_distr_cont_set_domain(distr,0.,UNUR_INFINITY); os = unur_distr_corder_new(distr,10,7); par = unur_arou_new(os); gen = unur_init(par); -->compare_sequence_gen_start unur_free(gen); gen = NULL; unur_distr_free(distr); distr = NULL; unur_distr_free(os); os = NULL; gen = unur_str2gen("normal; domain=(0.,inf); orderstatistics=(10,7) & \ method = arou"); -->compare_sequence_gen ############################################################################# [validate] [validate - generators:] # TDR par[0] = unur_tdr_new(@distr@); unur_tdr_set_cpoints(par,50,NULL); # AROU par[1] = unur_arou_new(@distr@); # NINV par[4] = unur_ninv_new(@distr@); [validate - distributions:] # Beta distributions { UNUR_DISTR *d; fpm[0] = 1.; fpm[1] = 2.; d = unur_distr_beta(fpm,2); distr[0] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } { UNUR_DISTR *d; fpm[0] = 3.; fpm[1] = 4.; d = unur_distr_beta(fpm,2); distr[1] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } { UNUR_DISTR *d; fpm[0] = 5.; fpm[1] = 100.; d = unur_distr_beta(fpm,2); distr[2] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } # Cauchy distributions { UNUR_DISTR *d; d = unur_distr_cauchy(NULL,0); distr[3] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } # Gamma distributions { UNUR_DISTR *d; fpm[0] = 1.; d = unur_distr_gamma( fpm,1 ); distr[4] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } { UNUR_DISTR *d; fpm[0] = 2.; d = unur_distr_gamma( fpm,1 ); distr[5] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } { UNUR_DISTR *d; fpm[0] = 3.; d = unur_distr_gamma( fpm,1 ); distr[6] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } { UNUR_DISTR *d; fpm[0] = 10.; d = unur_distr_gamma( fpm,1 ); distr[7] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } { UNUR_DISTR *d; fpm[0] = 100.; d = unur_distr_gamma( fpm,1 ); distr[8] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } # Normal distributions { UNUR_DISTR *d; d = unur_distr_normal( NULL,0 ); distr[9] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } { UNUR_DISTR *d; fpm[0] = 1.; fpm[1] = 0.01; d = unur_distr_normal( fpm,2 ); distr[10] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } { UNUR_DISTR *d; fpm[0] = 0.; fpm[1] = 100.; d = unur_distr_normal( fpm,2 ); distr[11] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } # Uniform distributions { UNUR_DISTR *d; d = unur_distr_uniform(NULL,0); distr[12] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } # truncated distributions { UNUR_DISTR *d; d = unur_distr_cauchy(NULL,0); distr[13] = unur_distr_corder_new( d, 10, 8); unur_distr_cont_set_domain(distr[13],0.1,1.); unur_distr_cont_upd_pdfarea(distr[13]); unur_distr_free(d); } {UNUR_DISTR *d; d = unur_distr_cauchy(NULL,0); unur_distr_cont_set_domain(d,0.1,1.); unur_distr_cont_upd_mode(d); unur_distr_cont_upd_pdfarea(d); distr[14] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } # function string {UNUR_DISTR *d; d = unur_str2distr("cont; pdf=\"exp(-x)\"; cdf=\"1-exp(-x)\"; domain=(0,inf); mode=0; pdfarea=1;"); distr[15] = unur_distr_corder_new( d, 10, 8); unur_distr_free(d); } [validate - test chi2:] # + ... pass test # 0 ... fail to initialize generator # - ... fail test # . ... do not run test # # ... comment # # generators: # [0] TDR # [1] AROU # [2] NINV # # [0] [1] [2] # distribution #----------------------------------------------------- <0> + + + # beta (1, 2) <1> + + + # beta (3, 4) <2> + + + # beta (5, 100) <3> + + + # cauchy () <4> + + + # gamma (1) <5> + + + # gamma (2) <6> + + + # gamma (3) <7> + + + # gamma (10) x <8> + + + # gamma (100) <9> + + + # normal () <10> + + + # normal (1, 0.01) <11> + + + # normal (0, 100) <12> + + + # uniform () <13> + + + # cauchy () - truncated <14> + + + # cauchy () - truncated <15> + + + # exponential(1) (function string) ############################################################################# ############################################################################# [verbatim] #############################################################################