1# $Id: t_distr_cxtrans.conf 5330 2011-04-19 10:50:18Z leydold $ 2############################################################################# 3 4[main] 5 6[main - data:] 7 8# method (for information only: the program scans the file name) 9method: DISTR_CXTRANS 10 11[main - header:] 12 13/* prototypes */ 14 15\#define COMPARE_SAMPLE_SIZE (500) 16\#define VIOLATE_SAMPLE_SIZE (20) 17 18############################################################################# 19 20[new] 21 22[new - invalid NULL ptr: 23 distr = NULL; ] 24 25unur_distr_cxtrans_new( distr ); 26 --> expected_NULL --> UNUR_ERR_NULL 27 28 29[new - invalid distribution type: 30 distr = unur_distr_discr_new(); ] 31 32unur_distr_cxtrans_new( distr ); 33 --> expected_NULL --> UNUR_ERR_DISTR_INVALID 34 35 36############################################################################# 37 38[set] 39 40[set - invalid NULL ptr: 41 distr = NULL; ] 42 43unur_distr_cxtrans_set_alpha( distr, 5. ); 44 --> expected_setfailed --> UNUR_ERR_NULL 45 46unur_distr_cxtrans_set_rescale( distr, 1., 1. ); 47 --> expected_setfailed --> UNUR_ERR_NULL 48 49unur_distr_cxtrans_set_domain( distr, 0., 1. ) 50 --> expected_setfailed --> UNUR_ERR_NULL 51 52unur_distr_cxtrans_set_mode( distr, 0. ) 53 --> expected_setfailed --> UNUR_ERR_NULL 54 55unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) 56 --> expected_setfailed --> UNUR_ERR_NULL 57 58 59[set - invalid distribution object: 60 distr = unur_distr_discr_new(); ] 61 62unur_distr_cxtrans_set_alpha( distr, 5. ); 63 --> expected_setfailed --> UNUR_ERR_DISTR_INVALID 64 65unur_distr_cxtrans_set_rescale( distr, 1., 1. ); 66 --> expected_setfailed --> UNUR_ERR_DISTR_INVALID 67 68unur_distr_cxtrans_set_domain( distr, 0., 1. ) 69 --> expected_setfailed --> UNUR_ERR_DISTR_INVALID 70 71unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) 72 --> expected_setfailed --> UNUR_ERR_DISTR_INVALID 73 74 75[set - invalid distribution object: 76 distr = unur_distr_normal(NULL,0); ] 77 78unur_distr_cxtrans_set_alpha( distr, 5. ); 79 --> expected_setfailed --> UNUR_ERR_DISTR_INVALID 80 81unur_distr_cxtrans_set_rescale( distr, 1., 1. ); 82 --> expected_setfailed --> UNUR_ERR_DISTR_INVALID 83 84unur_distr_cxtrans_set_domain( distr, 0., 1. ) 85 --> expected_setfailed --> UNUR_ERR_DISTR_INVALID 86 87unur_distr_cxtrans_set_logpdfpole( distr, 0., 0. ) 88 --> expected_setfailed --> UNUR_ERR_DISTR_INVALID 89 90 91[set - invalid parameters: 92 UNUR_DISTR *cxt; 93 distr = unur_distr_normal(NULL,0); 94 cxt = unur_distr_cxtrans_new( distr ); ] 95 96unur_distr_cxtrans_set_alpha( cxt, -5. ); 97 --> expected_setfailed --> UNUR_ERR_DISTR_SET 98 99unur_distr_cxtrans_set_rescale( cxt, 1., -1. ); 100 --> expected_setfailed --> UNUR_ERR_DISTR_SET 101 102unur_distr_cxtrans_set_alpha( cxt, 0. ); 103 --> expected_setfailed --> UNUR_ERR_DISTR_SET 104 105unur_distr_cxtrans_set_alpha( cxt, UNUR_INFINITY ); 106unur_distr_cxtrans_set_domain( cxt, -1., 1. ) 107 --> expected_setfailed --> UNUR_ERR_DISTR_SET 108 109unur_distr_free(cxt); 110 111 112############################################################################# 113 114[get] 115 116[get - invalid NULL ptr: 117 distr = NULL; ] 118 119unur_distr_cxtrans_get_distribution( distr ); 120 --> expected_NULL --> UNUR_ERR_NULL 121 122unur_distr_cxtrans_get_alpha( distr ); 123 --> expected_negINFINITY --> UNUR_ERR_NULL 124 125unur_distr_cxtrans_get_mu( distr ); 126 --> expected_negINFINITY --> UNUR_ERR_NULL 127 128unur_distr_cxtrans_get_sigma( distr ); 129 --> expected_negINFINITY --> UNUR_ERR_NULL 130 131 132[get - invalid distribution type: 133 distr = unur_distr_discr_new(); ] 134 135unur_distr_cxtrans_get_distribution( distr ); 136 --> expected_NULL --> UNUR_ERR_DISTR_INVALID 137 138unur_distr_cxtrans_get_alpha( distr ); 139 --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID 140 141unur_distr_cxtrans_get_mu( distr ); 142 --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID 143 144unur_distr_cxtrans_get_sigma( distr ); 145 --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID 146 147 148[get - invalid distribution id: 149 distr = unur_distr_cont_new(); ] 150 151unur_distr_cxtrans_get_distribution( distr ); 152 --> expected_NULL --> UNUR_ERR_DISTR_INVALID 153 154unur_distr_cxtrans_get_alpha( distr ); 155 --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID 156 157unur_distr_cxtrans_get_mu( distr ); 158 --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID 159 160unur_distr_cxtrans_get_sigma( distr ); 161 --> expected_negINFINITY --> UNUR_ERR_DISTR_INVALID 162 163 164############################################################################# 165 166# [chg] 167 168############################################################################# 169 170# [init] 171 172############################################################################# 173 174# [reinit] 175 176############################################################################# 177 178[sample] 179 180[sample - compare clone: 181 UNUR_GEN *clone; 182 UNUR_DISTR *d; 183 d = unur_distr_cauchy(NULL,0); 184 unur_distr_cont_set_domain(d,0.,UNUR_INFINITY); 185 distr = unur_distr_cxtrans_new( d ); 186 unur_distr_cxtrans_set_alpha(distr, 0.5 ); 187 unur_distr_free(d); 188 par = unur_arou_new(distr); 189 unur_arou_set_max_sqhratio(par,0.); 190 gen = unur_init( par ); <-- ! NULL ] 191 192/* original generator object */ 193 -->compare_sequence_gen_start 194 195/* clone */ 196clone = unur_gen_clone(gen); 197unur_free(gen); 198gen = clone; 199 -->compare_sequence_gen 200 201#..................................................................... 202 203#[sample - compare stringparser: ] 204 205 206############################################################################# 207 208[validate] 209 210[validate - generators:] 211 212# TDR 213par[0] = unur_tdr_new(@distr@); 214 215# AROU 216par[1] = unur_arou_new(@distr@); 217 218# SROU 219par[2] = unur_srou_new(@distr@); 220 221# HINV 222par[3] = unur_ninv_new(@distr@); 223 224# TABL 225par[4] = unur_tabl_new(@distr@); 226 227[validate - distributions:] 228 229# Exponential distribution with logPDF 230{ UNUR_DISTR *d; 231d = unur_distr_exponential( NULL, 0 ); 232distr[0] = unur_distr_cxtrans_new( d ); 233unur_distr_cxtrans_set_alpha(distr[0], UNUR_INFINITY ); 234unur_distr_cxtrans_set_mode(distr[0],1.); 235unur_distr_free(d); } 236 237{ UNUR_DISTR *d; 238d = unur_distr_exponential( NULL, 0 ); 239distr[1] = unur_distr_cxtrans_new( d ); 240unur_distr_cxtrans_set_alpha(distr[1], 2.); 241unur_distr_free(d); } 242 243{ UNUR_DISTR *d; 244d = unur_distr_exponential( NULL, 0 ); 245distr[2] = unur_distr_cxtrans_new( d ); 246unur_distr_cxtrans_set_alpha(distr[2], 1.); 247unur_distr_cxtrans_set_mode(distr[2],0.); 248unur_distr_free(d); } 249 250{ UNUR_DISTR *d; 251d = unur_distr_exponential( NULL, 0 ); 252distr[3] = unur_distr_cxtrans_new( d ); 253unur_distr_cxtrans_set_alpha(distr[3], 0.5); 254unur_distr_cxtrans_set_mode(distr[3],0.7071067811865475); 255unur_distr_free(d); } 256 257{ UNUR_DISTR *d; 258d = unur_distr_exponential( NULL, 0 ); 259distr[4] = unur_distr_cxtrans_new( d ); 260unur_distr_cxtrans_set_alpha(distr[4], 0.1); 261unur_distr_cxtrans_set_mode(distr[4],0.9895192582062144); 262unur_distr_free(d); } 263 264{ UNUR_DISTR *d; 265d = unur_distr_exponential( NULL, 0 ); 266distr[5] = unur_distr_cxtrans_new( d ); 267unur_distr_cxtrans_set_alpha(distr[5], 0.001); 268unur_distr_cxtrans_set_mode(distr[5],0.9999989995001669); 269unur_distr_free(d); } 270 271{ UNUR_DISTR *d; 272d = unur_distr_exponential( NULL, 0 ); 273distr[6] = unur_distr_cxtrans_new( d ); 274unur_distr_cxtrans_set_alpha(distr[6], 0.); 275unur_distr_cxtrans_set_mode(distr[6],0.); 276unur_distr_free(d); } 277 278 279# Exponential distribution without logPDF 280{ UNUR_DISTR *d; 281d = unur_distr_exponential_wo_logpdf( NULL, 0 ); 282distr[7] = unur_distr_cxtrans_new( d ); 283unur_distr_cxtrans_set_alpha(distr[7], UNUR_INFINITY ); 284unur_distr_cxtrans_set_mode(distr[7],1.); 285unur_distr_free(d); } 286 287{ UNUR_DISTR *d; 288d = unur_distr_exponential_wo_logpdf( NULL, 0 ); 289distr[8] = unur_distr_cxtrans_new( d ); 290unur_distr_cxtrans_set_alpha(distr[8], 2.); 291unur_distr_free(d); } 292 293{ UNUR_DISTR *d; 294d = unur_distr_exponential_wo_logpdf( NULL, 0 ); 295distr[9] = unur_distr_cxtrans_new( d ); 296unur_distr_cxtrans_set_alpha(distr[9], 1.); 297unur_distr_cxtrans_set_mode(distr[9],0.); 298unur_distr_free(d); } 299 300{ UNUR_DISTR *d; 301d = unur_distr_exponential_wo_logpdf( NULL, 0 ); 302distr[10] = unur_distr_cxtrans_new( d ); 303unur_distr_cxtrans_set_alpha(distr[10], 0.5); 304unur_distr_cxtrans_set_mode(distr[10],0.7071067811865475); 305unur_distr_free(d); } 306 307{ UNUR_DISTR *d; 308d = unur_distr_exponential_wo_logpdf( NULL, 0 ); 309distr[11] = unur_distr_cxtrans_new( d ); 310unur_distr_cxtrans_set_alpha(distr[11], 0.1); 311unur_distr_cxtrans_set_mode(distr[11],0.9895192582062144); 312unur_distr_free(d); } 313 314{ UNUR_DISTR *d; 315d = unur_distr_exponential_wo_logpdf( NULL, 0 ); 316distr[12] = unur_distr_cxtrans_new( d ); 317unur_distr_cxtrans_set_alpha(distr[12], 0.001); 318unur_distr_cxtrans_set_mode(distr[12],0.9999989995001669); 319unur_distr_free(d); } 320 321{ UNUR_DISTR *d; 322d = unur_distr_exponential_wo_logpdf( NULL, 0 ); 323distr[13] = unur_distr_cxtrans_new( d ); 324unur_distr_cxtrans_set_alpha(distr[13], 0.); 325unur_distr_cxtrans_set_mode(distr[13],0.); 326unur_distr_free(d); } 327 328 329 330# Gamma distributions 331#{ UNUR_DISTR *d; 332#fpm[0] = 1.; 333#d = unur_distr_gamma( fpm,1 ); 334#distr[4] = unur_distr_cxtrans_new( d, 10, 8); 335#unur_distr_free(d); } 336 337 338[validate - test chi2:] 339# 340# + ... pass test 341# 0 ... fail to initialize generator 342# - ... fail test 343# . ... do not run test 344# # ... comment 345# 346# generators: 347# [0] TDR 348# [1] AROU 349# [2] SROU 350# [3] HINV 351# [4] TABL 352# 353# [0] [1] [2] [3] [4] # distribution 354#----------------------------------------------------- 355x <0> + + + + + # exponential (1), alpha=inf (exp) 356x <1> . . . + . # exponential (1), alpha=2 357 <2> + x+ + + + # exponential (1), alpha=1 358x <3> + + + + + # exponential (1), alpha=0.5 359x <4> + + + + + # exponential (1), alpha=0.1 360x <5> + . + + + # exponential (1), alpha=0.001 361x <6> . . + + + # exponential (1), alpha=0 (log) 362x <7> + + + + + # exponential_wo_logpdf (1), alpha=inf (exp) 363x <8> . . . + . # exponential_wo_logpdf (1), alpha=2 364x <9> + + + + + # exponential_wo_logpdf (1), alpha=1 365x<10> + + + + + # exponential_wo_logpdf (1), alpha=0.5 366x<11> + + + + + # exponential_wo_logpdf (1), alpha=0.1 367x<12> + . + + + # exponential_wo_logpdf (1), alpha=0.001 368x<13> . . + + + # exponential_wo_logpdf (1), alpha=0 (log) 369 370 371############################################################################# 372############################################################################# 373 374[verbatim] 375 376############################################################################# 377